Skip to content

fix: make CBA workflow release Gurobi license after each rolling horizon optimization and fail if optimization is infeasible when using HiGHS - #756

Merged
measrainsey merged 21 commits into
masterfrom
fix/gurobi-license-env
Jul 9, 2026
Merged

fix: make CBA workflow release Gurobi license after each rolling horizon optimization and fail if optimization is infeasible when using HiGHS#756
measrainsey merged 21 commits into
masterfrom
fix/gurobi-license-env

Conversation

@measrainsey

@measrainsey measrainsey commented Jun 19, 2026

Copy link
Copy Markdown
Member

Closes:

Changes proposed in this Pull Request

PR to release Gurobi license after each rolling horizon is complete (if feasible, then just dispose of Gurobi environment; if infeasible, first compute IIS then dispose of the environment) to avoid running into issues with license usage

Tasks

  • Release Gurobi license after a rolling horizon passes (or if the RH window is infeasible, first calculate the IIS, then release the license)
  • If non-Gurobi/Xpress license is used (e.g., HiGHS) and rolling horizon is infeasible, raise error instead of silently passing

Workflow

Currently, if Gurobi is used as the solver for the rolling horizon optimization, if solving at high resolution, the first rolling horizon doesn't release the Gurobi license in time. Thus, when the next rolling horizon starts, there is a license usage conflict, which causes the workflow to fail.

To fix that, we should release the Gurobi license/model after every rolling horizon is done (if successful). If the rolling horizon's optimization unsuccessful/infeasible, in the case of Gurobi, the IIS is computed first, then the model is disposed of.

Notes

Release Gurobi license

To test, I first ran the following config (called config/config.zib.yaml) on ZIB, with the command snakemake --profile profiles/slurm -call cba --configfile config/config.tyndp.yaml config/config.zib.yaml:

run:
  name: "NT"

clustering:
  temporal:
    resolution_sector: 1H

solving:
  options:
    assign_all_duals: true
    include_objective_constant: false
  solver:
    name: gurobi
    options: gurobi-default
  partition: big
  mem_mb: 40000
  runtime: 1h

cba:
  planning_horizons:
  - 2030

  projects: [t4, t16]

  msv_extraction:
    solving:
      options:
        include_objective_constant: false
      solver:
        name: gurobi
        options: gurobi-default
      solver_options:
        gurobi-default:
          BarConvTol: 1.0e-06
      partition: big
      mem_mb: 40000
      runtime: 1h

  # Rolling horizon solving settings
  solving:
    options:
      include_objective_constant: false
    partition: big
    mem_mb: 40000
    runtime: 1h

    solver:
      name: gurobi
      options: gurobi-simplex

    solver_options:
      gurobi-simplex:
        FeasibilityTol: 1.0e-06
        OptimalityTol: 1.0e-06

On master, the solves for t4, t16, and reference networks start around the same time, and they all fail early (around the second rolling horizon) due to clashing license needs.

See the below for the logs:

Details

Reference network solve:

[Fri Jun 19 15:47:31 2026]
localrule solve_cba_reference_network:
    input: resources/tyndp/NT/cba/networks/rl_2030.nc
    output: results/tyndp/NT/cba/networks/reference_2030.nc
    log: results/tyndp/NT/logs/cba/reference/reference_2030_solver.log, results/tyndp/NT/logs/cba/reference/reference_2030_memory.log, results/tyndp/NT/logs/cba/reference/reference_2030_python.log
    jobid: 0
    reason: Forced execution
    wildcards: run=NT, planning_horizons=2030
    resources: mem_mb=40000, mem_mib=38147, disk_mb=8000, disk_mib=7630, tmpdir=/scratch/local, runtime=60, partition=big
getfattr: Removing leading '/' from absolute path names
INFO:pypsa.network.io:New version 1.2.3 available! (Current: 1.2.1)
INFO:pypsa.network.io:Imported network 'PyPSA-Eur (tyndp)' has buses, carriers, generators, global_constraints, links, loads, shapes, storage_units, stores, sub_networks
INFO:scripts.solve_network:Add load shedding for all carriers.
WARNING:pypsa.network.io:The following generators are already defined and will be skipped (use overwrite=True to overwrite): AL H2 load shedding, AT H2 load shedding, BA H2 load shedding, BE H2 load shedding, BG H2 load shedding, CH H2 load shedding, CY H2 load shedding, CZ H2 load shedding, DE H2 load shedding, DK H2 load shedding, EE H2 load shedding, ES H2 load shedding, FI H2 load shedding, FR H2 load shedding, GB H2 load shedding, GR H2 load shedding, HR H2 load shedding, HU H2 load shedding, IE H2 load shedding, IT H2 load shedding, LT H2 load shedding, LU H2 load shedding, LV H2 load shedding, ME H2 load shedding, MK H2 load shedding, MT H2 load shedding, NL H2 load shedding, NO H2 load shedding, PL H2 load shedding, PT H2 load shedding, RO H2 load shedding, RS H2 load shedding, SE H2 load shedding, SI H2 load shedding, SK H2 load shedding, IBIT H2 load shedding, IBFI H2 load shedding
WARNING:pypsa.network.io:The following generators are already defined and will be skipped (use overwrite=True to overwrite): AL00 load shedding, AT00 load shedding, BA00 load shedding, BE00 load shedding, BG00 load shedding, CH00 load shedding, CY00 load shedding, CZ00 load shedding, DE00 load shedding, DKE1 load shedding, DKW1 load shedding, EE00 load shedding, ES00 load shedding, FI00 load shedding, FR00 load shedding, FR15 load shedding, GB00 load shedding, GBNI load shedding, GR00 load shedding, GR03 load shedding, HR00 load shedding, HU00 load shedding, IE00 load shedding, ITCA load shedding, ITCN load shedding, ITCS load shedding, ITN1 load shedding, ITS1 load shedding, ITSA load shedding, ITSI load shedding, LT00 load shedding, LUB1 load shedding, LUF1 load shedding, LUG1 load shedding, LUV1 load shedding, LV00 load shedding, ME00 load shedding, MK00 load shedding, MT00 load shedding, NL00 load shedding, NOM1 load shedding, NON1 load shedding, NOS0 load shedding, PL00 load shedding, PT00 load shedding, RO00 load shedding, RS00 load shedding, SE01 load shedding, SE02 load shedding, SE03 load shedding, SE04 load shedding, SI00 load shedding, SK00 load shedding, ITCO load shedding, ITVI load shedding
WARNING:scripts.add_electricity:tech_colors for carriers ['none'] not defined in config.

  0%|          | 0/53 [00:00<?, ?it/s]INFO:__main__:Optimizing network for snapshot horizon [2009-01-01 00:00:00:2009-01-07 23:00:00] (1/53).
/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/pypsa/optimization/optimize.py:566: FutureWarning: Passing an int for `transmission_losses` is deprecated and will be removed in PyPSA 2.0. Explicitly pass {'mode': 'tangents', 'segments': 2} (current behavior) or use the new secant-based losses via `transmission_losses=True`.
  m = n.optimize.create_model(
INFO:linopy.model: Solve problem using Gurobi solver
INFO:linopy.model:Solver logs written to `results/tyndp/NT/logs/cba/reference/reference_2030_solver.log`.
INFO:linopy.model:Solver options:
 - threads: 32
 - method: 1
 - NodeMethod: 1
 - Seed: 123
 - AggFill: 0
 - PreDual: 0
 - FeasibilityTol: 1e-06
 - OptimalityTol: 1e-06
 - ScaleFlag: -1
Set parameter WLSAccessID
Set parameter WLSSecret
Set parameter LicenseID to value 2464355
WLS license 2464355 - registered to Open Energy Transition GmbH
Warning for adding constraints: zero or small (< 1e-13) coefficients, ignored
Set parameter Threads to value 32
Set parameter Method to value 1
Set parameter NodeMethod to value 1
Set parameter Seed to value 123
Set parameter AggFill to value 0
Set parameter PreDual to value 0
Set parameter FeasibilityTol to value 1e-06
Set parameter OptimalityTol to value 1e-06
Set parameter ScaleFlag to value -1
Set parameter LogFile to value "/scratch/htc-panfs/mmeng/open-tyndp/results/tyndp/NT/logs/cba/reference/reference_2030_solver.log"
Gurobi Optimizer version 13.0.2 build v13.0.2rc1 (linux64 - "Debian GNU/Linux 13 (trixie)")

CPU model: AMD EPYC 7542 32-Core Processor, instruction set [SSE2|AVX|AVX2]
Thread count: 64 physical cores, 128 logical processors, using up to 8 threads

Non-default parameters:
Method  1
NodeMethod  1
AggFill  0
PreDual  0
Seed  123
Threads  32

WLS license 2464355 - registered to Open Energy Transition GmbH
Optimize a model with 783062 rows, 397320 columns and 1391514 nonzeros (Min)
Model fingerprint: 0x6020b2ae
Model has 360528 linear objective coefficients
Coefficient statistics:
  Matrix range     [1e-02, 1e+00]
  Objective range  [9e-03, 1e+05]
  Bounds range     [3e+00, 2e+03]
  RHS range        [1e-02, 2e+09]
Warning: Model contains large rhs
         Consider reformulating model or setting NumericFocus parameter
         to avoid numerical issues.

Presolve time: 0.82s
Presolved: 30773 rows, 227643 columns, 383073 nonzeros

Iteration    Objective       Primal Inf.    Dual Inf.      Time
       0    6.5506517e+09   2.839106e+07   0.000000e+00      1s

Extra simplex iterations after uncrush: 168
   55188    1.2026235e+10   0.000000e+00   0.000000e+00      3s

Solved in 55188 iterations and 3.08 seconds (3.10 work units)
Optimal objective  1.202623498e+10
Warning: environment still referenced so free is deferred (Continue to use WLS)
INFO:linopy.constants: Optimization successful: 
Status: ok
Termination condition: optimal
Solution: 397320 primals, 783062 duals
Objective: 1.20e+10
Solver model: available
Solver message: 2


  2%|| 1/53 [00:29<25:19, 29.22s/it]INFO:__main__:Optimizing network for snapshot horizon [2009-01-07 23:00:00:2009-01-14 22:00:00] (2/53).
WARNING:pypsa.optimization.constraints:Stores ['AT00 battery', 'BE00 battery', 'DE00 battery', 'DKW1 battery', 'ES00 battery', 'GB00 battery', 'GR00 battery', 'GR03 battery', 'HR00 battery', 'HU00 battery', 'ITCA battery', 'ITCN battery', 'ITN1 battery', 'ITS1 battery', 'ITSA battery', 'ITSI battery', 'LT00 battery', 'LUG1 battery', 'LV00 battery', 'NL00 battery', 'SE01 battery', 'SE02 battery', 'SE03 battery', 'SE04 battery', 'SK00 battery']: Cyclic energy level constraint overrules initial value setting. User-defined e_initial will be ignored.
/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/pypsa/optimization/optimize.py:566: FutureWarning: Passing an int for `transmission_losses` is deprecated and will be removed in PyPSA 2.0. Explicitly pass {'mode': 'tangents', 'segments': 2} (current behavior) or use the new secant-based losses via `transmission_losses=True`.
  m = n.optimize.create_model(
INFO:linopy.model: Solve problem using Gurobi solver
INFO:linopy.model:Solver logs written to `results/tyndp/NT/logs/cba/reference/reference_2030_solver.log`.
INFO:linopy.model:Solver options:
 - threads: 32
 - method: 1
 - NodeMethod: 1
 - Seed: 123
 - AggFill: 0
 - PreDual: 0
 - FeasibilityTol: 1e-06
 - OptimalityTol: 1e-06
 - ScaleFlag: -1
Set parameter WLSAccessID
Set parameter WLSSecret
Set parameter LicenseID to value 2464355
WLS license 2464355 - registered to Open Energy Transition GmbH

  2%|| 1/53 [00:33<28:58, 33.43s/it]
ERROR:root:Uncaught exception
Traceback (most recent call last):
  File "/scratch/htc-panfs/mmeng/open-tyndp/.snakemake/scripts/tmp66o0co96.solve_cba_network.py", line 340, in <module>
    solve_network(
  File "/scratch/htc-panfs/mmeng/open-tyndp/.snakemake/scripts/tmp66o0co96.solve_cba_network.py", line 281, in solve_network
    status, condition = optimize_with_rolling_horizon(n, **all_kwargs)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/htc-panfs/mmeng/open-tyndp/.snakemake/scripts/tmp66o0co96.solve_cba_network.py", line 182, in optimize_with_rolling_horizon
    status, condition = n.optimize(sns, **kwargs)  # type: ignore
                        ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/pypsa/optimization/optimize.py", line 581, in __call__
    status, condition = m.solve(
                        ^^^^^^^^
  File "/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/linopy/model.py", line 1403, in solve
    result = solver.solve_problem_from_model(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/linopy/solvers.py", line 1088, in solve_problem_from_model
    env_ = stack.enter_context(gurobipy.Env())
                               ^^^^^^^^^^^^^^
  File "src/gurobipy/env.pxi", line 112, in gurobipy._core.Env.__init__
gurobipy._exception.GurobiError: Single-use license. Another Gurobi process with pid 4100464 running.
RuleException:
CalledProcessError in file "/scratch/htc-panfs/mmeng/open-tyndp/rules/cba.smk", line 403:
Command 'set -euo pipefail;  /scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/bin/python3.12 /scratch/htc-panfs/mmeng/open-tyndp/.snakemake/scripts/tmp66o0co96.solve_cba_network.py' returned non-zero exit status 1.

Project t4:

[Fri Jun 19 15:48:49 2026]
localrule solve_cba_network:
    input: resources/tyndp/NT/cba/networks/project_t4_2030.nc
    output: results/tyndp/NT/cba/networks/project_t4_2030.nc
    log: results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log, results/tyndp/NT/logs/cba/projects/project_t4_2030_memory.log, results/tyndp/NT/logs/cba/projects/project_t4_2030_python.log
    jobid: 0
    reason: Forced execution
    wildcards: run=NT, cba_project=t4, planning_horizons=2030
    resources: mem_mb=40000, mem_mib=38147, disk_mb=8000, disk_mib=7630, tmpdir=/scratch/local, runtime=60, partition=big
getfattr: Removing leading '/' from absolute path names
INFO:pypsa.network.io:New version 1.2.3 available! (Current: 1.2.1)
INFO:pypsa.network.io:Imported network 'PyPSA-Eur (tyndp)' has buses, carriers, generators, global_constraints, links, loads, shapes, storage_units, stores, sub_networks
INFO:scripts.solve_network:Add load shedding for all carriers.
WARNING:pypsa.network.io:The following generators are already defined and will be skipped (use overwrite=True to overwrite): AL H2 load shedding, AT H2 load shedding, BA H2 load shedding, BE H2 load shedding, BG H2 load shedding, CH H2 load shedding, CY H2 load shedding, CZ H2 load shedding, DE H2 load shedding, DK H2 load shedding, EE H2 load shedding, ES H2 load shedding, FI H2 load shedding, FR H2 load shedding, GB H2 load shedding, GR H2 load shedding, HR H2 load shedding, HU H2 load shedding, IE H2 load shedding, IT H2 load shedding, LT H2 load shedding, LU H2 load shedding, LV H2 load shedding, ME H2 load shedding, MK H2 load shedding, MT H2 load shedding, NL H2 load shedding, NO H2 load shedding, PL H2 load shedding, PT H2 load shedding, RO H2 load shedding, RS H2 load shedding, SE H2 load shedding, SI H2 load shedding, SK H2 load shedding, IBIT H2 load shedding, IBFI H2 load shedding
WARNING:pypsa.network.io:The following generators are already defined and will be skipped (use overwrite=True to overwrite): AL00 load shedding, AT00 load shedding, BA00 load shedding, BE00 load shedding, BG00 load shedding, CH00 load shedding, CY00 load shedding, CZ00 load shedding, DE00 load shedding, DKE1 load shedding, DKW1 load shedding, EE00 load shedding, ES00 load shedding, FI00 load shedding, FR00 load shedding, FR15 load shedding, GB00 load shedding, GBNI load shedding, GR00 load shedding, GR03 load shedding, HR00 load shedding, HU00 load shedding, IE00 load shedding, ITCA load shedding, ITCN load shedding, ITCS load shedding, ITN1 load shedding, ITS1 load shedding, ITSA load shedding, ITSI load shedding, LT00 load shedding, LUB1 load shedding, LUF1 load shedding, LUG1 load shedding, LUV1 load shedding, LV00 load shedding, ME00 load shedding, MK00 load shedding, MT00 load shedding, NL00 load shedding, NOM1 load shedding, NON1 load shedding, NOS0 load shedding, PL00 load shedding, PT00 load shedding, RO00 load shedding, RS00 load shedding, SE01 load shedding, SE02 load shedding, SE03 load shedding, SE04 load shedding, SI00 load shedding, SK00 load shedding, ITCO load shedding, ITVI load shedding
WARNING:scripts.add_electricity:tech_colors for carriers ['none'] not defined in config.

  0%|          | 0/53 [00:00<?, ?it/s]INFO:__main__:Optimizing network for snapshot horizon [2009-01-01 00:00:00:2009-01-07 23:00:00] (1/53).
/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/pypsa/optimization/optimize.py:566: FutureWarning: Passing an int for `transmission_losses` is deprecated and will be removed in PyPSA 2.0. Explicitly pass {'mode': 'tangents', 'segments': 2} (current behavior) or use the new secant-based losses via `transmission_losses=True`.
  m = n.optimize.create_model(
INFO:linopy.model: Solve problem using Gurobi solver
INFO:linopy.model:Solver logs written to `results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log`.
INFO:linopy.model:Solver options:
 - threads: 32
 - method: 1
 - NodeMethod: 1
 - Seed: 123
 - AggFill: 0
 - PreDual: 0
 - FeasibilityTol: 1e-06
 - OptimalityTol: 1e-06
 - ScaleFlag: -1
Set parameter WLSAccessID
Set parameter WLSSecret
Set parameter LicenseID to value 2464355
WLS license 2464355 - registered to Open Energy Transition GmbH
Warning for adding constraints: zero or small (< 1e-13) coefficients, ignored
Set parameter Threads to value 32
Set parameter Method to value 1
Set parameter NodeMethod to value 1
Set parameter Seed to value 123
Set parameter AggFill to value 0
Set parameter PreDual to value 0
Set parameter FeasibilityTol to value 1e-06
Set parameter OptimalityTol to value 1e-06
Set parameter ScaleFlag to value -1
Set parameter LogFile to value "/scratch/htc-panfs/mmeng/open-tyndp/results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log"
Gurobi Optimizer version 13.0.2 build v13.0.2rc1 (linux64 - "Debian GNU/Linux 13 (trixie)")

CPU model: Intel(R) Xeon(R) Gold 6338 CPU @ 2.00GHz, instruction set [SSE2|AVX|AVX2|AVX512]
Thread count: 64 physical cores, 128 logical processors, using up to 8 threads

Non-default parameters:
Method  1
NodeMethod  1
AggFill  0
PreDual  0
Seed  123
Threads  32

WLS license 2464355 - registered to Open Energy Transition GmbH
Optimize a model with 783062 rows, 397320 columns and 1391514 nonzeros (Min)
Model fingerprint: 0xc7fce7a4
Model has 360528 linear objective coefficients
Coefficient statistics:
  Matrix range     [1e-02, 1e+00]
  Objective range  [9e-03, 1e+05]
  Bounds range     [3e+00, 2e+03]
  RHS range        [1e-02, 2e+09]
Warning: Model contains large rhs
         Consider reformulating model or setting NumericFocus parameter
         to avoid numerical issues.

Presolve time: 0.78s
Presolved: 30773 rows, 227643 columns, 383073 nonzeros

Iteration    Objective       Primal Inf.    Dual Inf.      Time
       0    6.5506517e+09   2.839106e+07   0.000000e+00      1s

Extra simplex iterations after uncrush: 168
   55807    1.2026253e+10   0.000000e+00   0.000000e+00      3s

Solved in 55807 iterations and 3.10 seconds (3.13 work units)
Optimal objective  1.202625323e+10
Warning: environment still referenced so free is deferred (Continue to use WLS)
INFO:linopy.constants: Optimization successful: 
Status: ok
Termination condition: optimal
Solution: 397320 primals, 783062 duals
Objective: 1.20e+10
Solver model: available
Solver message: 2


  2%|| 1/53 [00:31<27:40, 31.93s/it]INFO:__main__:Optimizing network for snapshot horizon [2009-01-07 23:00:00:2009-01-14 22:00:00] (2/53).
WARNING:pypsa.optimization.constraints:Stores ['AT00 battery', 'BE00 battery', 'BG00 battery', 'DE00 battery', 'DKW1 battery', 'ES00 battery', 'GB00 battery', 'GBNI battery', 'GR00 battery', 'HU00 battery', 'ITCA battery', 'ITN1 battery', 'ITSA battery', 'ITSI battery', 'LT00 battery', 'LUG1 battery', 'LV00 battery', 'NL00 battery', 'RO00 battery', 'SE01 battery', 'SE02 battery', 'SE03 battery', 'SE04 battery', 'SK00 battery']: Cyclic energy level constraint overrules initial value setting. User-defined e_initial will be ignored.
/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/pypsa/optimization/optimize.py:566: FutureWarning: Passing an int for `transmission_losses` is deprecated and will be removed in PyPSA 2.0. Explicitly pass {'mode': 'tangents', 'segments': 2} (current behavior) or use the new secant-based losses via `transmission_losses=True`.
  m = n.optimize.create_model(
INFO:linopy.model: Solve problem using Gurobi solver
INFO:linopy.model:Solver logs written to `results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log`.
INFO:linopy.model:Solver options:
 - threads: 32
 - method: 1
 - NodeMethod: 1
 - Seed: 123
 - AggFill: 0
 - PreDual: 0
 - FeasibilityTol: 1e-06
 - OptimalityTol: 1e-06
 - ScaleFlag: -1
Set parameter WLSAccessID
Set parameter WLSSecret
Set parameter LicenseID to value 2464355
WLS license 2464355 - registered to Open Energy Transition GmbH

  2%|| 1/53 [00:36<32:03, 36.99s/it]
ERROR:root:Uncaught exception
Traceback (most recent call last):
  File "/scratch/htc-panfs/mmeng/open-tyndp/.snakemake/scripts/tmp4fknxcyu.solve_cba_network.py", line 340, in <module>
    solve_network(
  File "/scratch/htc-panfs/mmeng/open-tyndp/.snakemake/scripts/tmp4fknxcyu.solve_cba_network.py", line 281, in solve_network
    status, condition = optimize_with_rolling_horizon(n, **all_kwargs)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/htc-panfs/mmeng/open-tyndp/.snakemake/scripts/tmp4fknxcyu.solve_cba_network.py", line 182, in optimize_with_rolling_horizon
    status, condition = n.optimize(sns, **kwargs)  # type: ignore
                        ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/pypsa/optimization/optimize.py", line 581, in __call__
    status, condition = m.solve(
                        ^^^^^^^^
  File "/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/linopy/model.py", line 1403, in solve
    result = solver.solve_problem_from_model(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/linopy/solvers.py", line 1088, in solve_problem_from_model
    env_ = stack.enter_context(gurobipy.Env())
                               ^^^^^^^^^^^^^^
  File "src/gurobipy/env.pxi", line 112, in gurobipy._core.Env.__init__
gurobipy._exception.GurobiError: Single-use license. Another Gurobi process with pid 455275 running.
RuleException:
CalledProcessError in file "/scratch/htc-panfs/mmeng/open-tyndp/rules/cba.smk", line 427:
Command 'set -euo pipefail;  /scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/bin/python3.12 /scratch/htc-panfs/mmeng/open-tyndp/.snakemake/scripts/tmp4fknxcyu.solve_cba_network.py' returned non-zero exit status 1.

Project t16:

[Fri Jun 19 15:48:19 2026]
localrule solve_cba_network:
    input: resources/tyndp/NT/cba/networks/project_t16_2030.nc
    output: results/tyndp/NT/cba/networks/project_t16_2030.nc
    log: results/tyndp/NT/logs/cba/projects/project_t16_2030_solver.log, results/tyndp/NT/logs/cba/projects/project_t16_2030_memory.log, results/tyndp/NT/logs/cba/projects/project_t16_2030_python.log
    jobid: 0
    reason: Forced execution
    wildcards: run=NT, cba_project=t16, planning_horizons=2030
    resources: mem_mb=40000, mem_mib=38147, disk_mb=8000, disk_mib=7630, tmpdir=/scratch/local, runtime=60, partition=big
getfattr: Removing leading '/' from absolute path names
INFO:pypsa.network.io:New version 1.2.3 available! (Current: 1.2.1)
INFO:pypsa.network.io:Imported network 'PyPSA-Eur (tyndp)' has buses, carriers, generators, global_constraints, links, loads, shapes, storage_units, stores, sub_networks
INFO:scripts.solve_network:Add load shedding for all carriers.
WARNING:pypsa.network.io:The following generators are already defined and will be skipped (use overwrite=True to overwrite): AL H2 load shedding, AT H2 load shedding, BA H2 load shedding, BE H2 load shedding, BG H2 load shedding, CH H2 load shedding, CY H2 load shedding, CZ H2 load shedding, DE H2 load shedding, DK H2 load shedding, EE H2 load shedding, ES H2 load shedding, FI H2 load shedding, FR H2 load shedding, GB H2 load shedding, GR H2 load shedding, HR H2 load shedding, HU H2 load shedding, IE H2 load shedding, IT H2 load shedding, LT H2 load shedding, LU H2 load shedding, LV H2 load shedding, ME H2 load shedding, MK H2 load shedding, MT H2 load shedding, NL H2 load shedding, NO H2 load shedding, PL H2 load shedding, PT H2 load shedding, RO H2 load shedding, RS H2 load shedding, SE H2 load shedding, SI H2 load shedding, SK H2 load shedding, IBIT H2 load shedding, IBFI H2 load shedding
WARNING:pypsa.network.io:The following generators are already defined and will be skipped (use overwrite=True to overwrite): AL00 load shedding, AT00 load shedding, BA00 load shedding, BE00 load shedding, BG00 load shedding, CH00 load shedding, CY00 load shedding, CZ00 load shedding, DE00 load shedding, DKE1 load shedding, DKW1 load shedding, EE00 load shedding, ES00 load shedding, FI00 load shedding, FR00 load shedding, FR15 load shedding, GB00 load shedding, GBNI load shedding, GR00 load shedding, GR03 load shedding, HR00 load shedding, HU00 load shedding, IE00 load shedding, ITCA load shedding, ITCN load shedding, ITCS load shedding, ITN1 load shedding, ITS1 load shedding, ITSA load shedding, ITSI load shedding, LT00 load shedding, LUB1 load shedding, LUF1 load shedding, LUG1 load shedding, LUV1 load shedding, LV00 load shedding, ME00 load shedding, MK00 load shedding, MT00 load shedding, NL00 load shedding, NOM1 load shedding, NON1 load shedding, NOS0 load shedding, PL00 load shedding, PT00 load shedding, RO00 load shedding, RS00 load shedding, SE01 load shedding, SE02 load shedding, SE03 load shedding, SE04 load shedding, SI00 load shedding, SK00 load shedding, ITCO load shedding, ITVI load shedding
WARNING:scripts.add_electricity:tech_colors for carriers ['none'] not defined in config.

  0%|          | 0/53 [00:00<?, ?it/s]INFO:__main__:Optimizing network for snapshot horizon [2009-01-01 00:00:00:2009-01-07 23:00:00] (1/53).
/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/pypsa/optimization/optimize.py:566: FutureWarning: Passing an int for `transmission_losses` is deprecated and will be removed in PyPSA 2.0. Explicitly pass {'mode': 'tangents', 'segments': 2} (current behavior) or use the new secant-based losses via `transmission_losses=True`.
  m = n.optimize.create_model(
INFO:linopy.model: Solve problem using Gurobi solver
INFO:linopy.model:Solver logs written to `results/tyndp/NT/logs/cba/projects/project_t16_2030_solver.log`.
INFO:linopy.model:Solver options:
 - threads: 32
 - method: 1
 - NodeMethod: 1
 - Seed: 123
 - AggFill: 0
 - PreDual: 0
 - FeasibilityTol: 1e-06
 - OptimalityTol: 1e-06
 - ScaleFlag: -1
Set parameter WLSAccessID
Set parameter WLSSecret
Set parameter LicenseID to value 2464355
WLS license 2464355 - registered to Open Energy Transition GmbH
Warning for adding constraints: zero or small (< 1e-13) coefficients, ignored
Set parameter Threads to value 32
Set parameter Method to value 1
Set parameter NodeMethod to value 1
Set parameter Seed to value 123
Set parameter AggFill to value 0
Set parameter PreDual to value 0
Set parameter FeasibilityTol to value 1e-06
Set parameter OptimalityTol to value 1e-06
Set parameter ScaleFlag to value -1
Set parameter LogFile to value "/scratch/htc-panfs/mmeng/open-tyndp/results/tyndp/NT/logs/cba/projects/project_t16_2030_solver.log"
Gurobi Optimizer version 13.0.2 build v13.0.2rc1 (linux64 - "Debian GNU/Linux 13 (trixie)")

CPU model: Intel(R) Xeon(R) Gold 6338 CPU @ 2.00GHz, instruction set [SSE2|AVX|AVX2|AVX512]
Thread count: 64 physical cores, 128 logical processors, using up to 8 threads

Non-default parameters:
Method  1
NodeMethod  1
AggFill  0
PreDual  0
Seed  123
Threads  32

WLS license 2464355 - registered to Open Energy Transition GmbH
Optimize a model with 783062 rows, 397320 columns and 1391514 nonzeros (Min)
Model fingerprint: 0x4a25adb3
Model has 360528 linear objective coefficients
Coefficient statistics:
  Matrix range     [1e-02, 1e+00]
  Objective range  [9e-03, 1e+05]
  Bounds range     [3e+00, 2e+03]
  RHS range        [1e-02, 2e+09]
Warning: Model contains large rhs
         Consider reformulating model or setting NumericFocus parameter
         to avoid numerical issues.

Presolve time: 0.85s
Presolved: 30773 rows, 227643 columns, 383073 nonzeros

Iteration    Objective       Primal Inf.    Dual Inf.      Time
       0    6.5506517e+09   2.839106e+07   0.000000e+00      1s

Extra simplex iterations after uncrush: 168
   55256    1.2039546e+10   0.000000e+00   0.000000e+00      3s

Solved in 55256 iterations and 3.34 seconds (3.15 work units)
Optimal objective  1.203954636e+10
Warning: environment still referenced so free is deferred (Continue to use WLS)
INFO:linopy.constants: Optimization successful: 
Status: ok
Termination condition: optimal
Solution: 397320 primals, 783062 duals
Objective: 1.20e+10
Solver model: available
Solver message: 2


  2%|| 1/53 [00:32<28:03, 32.38s/it]INFO:__main__:Optimizing network for snapshot horizon [2009-01-07 23:00:00:2009-01-14 22:00:00] (2/53).
WARNING:pypsa.optimization.constraints:Stores ['BE00 battery', 'BG00 battery', 'DE00 battery', 'DKW1 battery', 'ES00 battery', 'GB00 battery', 'GBNI battery', 'HR00 battery', 'HU00 battery', 'ITCA battery', 'ITCN battery', 'ITSA battery', 'ITSI battery', 'LT00 battery', 'LV00 battery', 'NL00 battery', 'SE02 battery', 'SE03 battery', 'SE04 battery', 'SK00 battery']: Cyclic energy level constraint overrules initial value setting. User-defined e_initial will be ignored.
/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/pypsa/optimization/optimize.py:566: FutureWarning: Passing an int for `transmission_losses` is deprecated and will be removed in PyPSA 2.0. Explicitly pass {'mode': 'tangents', 'segments': 2} (current behavior) or use the new secant-based losses via `transmission_losses=True`.
  m = n.optimize.create_model(
INFO:linopy.model: Solve problem using Gurobi solver
INFO:linopy.model:Solver logs written to `results/tyndp/NT/logs/cba/projects/project_t16_2030_solver.log`.
INFO:linopy.model:Solver options:
 - threads: 32
 - method: 1
 - NodeMethod: 1
 - Seed: 123
 - AggFill: 0
 - PreDual: 0
 - FeasibilityTol: 1e-06
 - OptimalityTol: 1e-06
 - ScaleFlag: -1
Set parameter WLSAccessID
Set parameter WLSSecret
Set parameter LicenseID to value 2464355
WLS license 2464355 - registered to Open Energy Transition GmbH

  2%|| 1/53 [00:37<32:49, 37.87s/it]
ERROR:root:Uncaught exception
Traceback (most recent call last):
  File "/scratch/htc-panfs/mmeng/open-tyndp/.snakemake/scripts/tmpv021o5og.solve_cba_network.py", line 340, in <module>
    solve_network(
  File "/scratch/htc-panfs/mmeng/open-tyndp/.snakemake/scripts/tmpv021o5og.solve_cba_network.py", line 281, in solve_network
    status, condition = optimize_with_rolling_horizon(n, **all_kwargs)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/htc-panfs/mmeng/open-tyndp/.snakemake/scripts/tmpv021o5og.solve_cba_network.py", line 182, in optimize_with_rolling_horizon
    status, condition = n.optimize(sns, **kwargs)  # type: ignore
                        ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/pypsa/optimization/optimize.py", line 581, in __call__
    status, condition = m.solve(
                        ^^^^^^^^
  File "/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/linopy/model.py", line 1403, in solve
    result = solver.solve_problem_from_model(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/linopy/solvers.py", line 1088, in solve_problem_from_model
    env_ = stack.enter_context(gurobipy.Env())
                               ^^^^^^^^^^^^^^
  File "src/gurobipy/env.pxi", line 112, in gurobipy._core.Env.__init__
gurobipy._exception.GurobiError: Single-use license. Another Gurobi process with pid 173758 running.
RuleException:
CalledProcessError in file "/scratch/htc-panfs/mmeng/open-tyndp/rules/cba.smk", line 427:
Command 'set -euo pipefail;  /scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/bin/python3.12 /scratch/htc-panfs/mmeng/open-tyndp/.snakemake/scripts/tmpv021o5og.solve_cba_network.py' returned non-zero exit status 1.
[Fri Jun 19 15:49:09 2026]
Error in rule solve_cba_network:
    message: None
    jobid: 0
    input: resources/tyndp/NT/cba/networks/project_t16_2030.nc
    output: results/tyndp/NT/cba/networks/project_t16_2030.nc
    log: results/tyndp/NT/logs/cba/projects/project_t16_2030_solver.log, results/tyndp/NT/logs/cba/projects/project_t16_2030_memory.log, results/tyndp/NT/logs/cba/projects/project_t16_2030_python.log (check log file(s) for error details)
Shutting down, this might take some time.
Exiting because a job execution failed. Look below for error messages

Testing the same config file and command on this branch (fix/gurobi-license-env), the rolling horizon windows continuously solve without running into license issues:

Details

Reference network (truncated):

[Fri Jun 19 15:52:48 2026]
localrule solve_cba_reference_network:
    input: resources/tyndp/NT/cba/networks/rl_2030.nc
    output: results/tyndp/NT/cba/networks/reference_2030.nc
    log: results/tyndp/NT/logs/cba/reference/reference_2030_solver.log, results/tyndp/NT/logs/cba/reference/reference_2030_memory.log, results/tyndp/NT/logs/cba/reference/reference_2030_python.log
    jobid: 0
    reason: Forced execution
    wildcards: run=NT, planning_horizons=2030
    resources: mem_mb=40000, mem_mib=38147, disk_mb=8000, disk_mib=7630, tmpdir=/scratch/local, runtime=60, partition=big
getfattr: Removing leading '/' from absolute path names
INFO:pypsa.network.io:New version 1.2.3 available! (Current: 1.2.1)
INFO:pypsa.network.io:Imported network 'PyPSA-Eur (tyndp)' has buses, carriers, generators, global_constraints, links, loads, shapes, storage_units, stores, sub_networks
INFO:scripts.solve_network:Add load shedding for all carriers.
WARNING:pypsa.network.io:The following generators are already defined and will be skipped (use overwrite=True to overwrite): AL H2 load shedding, AT H2 load shedding, BA H2 load shedding, BE H2 load shedding, BG H2 load shedding, CH H2 load shedding, CY H2 load shedding, CZ H2 load shedding, DE H2 load shedding, DK H2 load shedding, EE H2 load shedding, ES H2 load shedding, FI H2 load shedding, FR H2 load shedding, GB H2 load shedding, GR H2 load shedding, HR H2 load shedding, HU H2 load shedding, IE H2 load shedding, IT H2 load shedding, LT H2 load shedding, LU H2 load shedding, LV H2 load shedding, ME H2 load shedding, MK H2 load shedding, MT H2 load shedding, NL H2 load shedding, NO H2 load shedding, PL H2 load shedding, PT H2 load shedding, RO H2 load shedding, RS H2 load shedding, SE H2 load shedding, SI H2 load shedding, SK H2 load shedding, IBIT H2 load shedding, IBFI H2 load shedding
WARNING:pypsa.network.io:The following generators are already defined and will be skipped (use overwrite=True to overwrite): AL00 load shedding, AT00 load shedding, BA00 load shedding, BE00 load shedding, BG00 load shedding, CH00 load shedding, CY00 load shedding, CZ00 load shedding, DE00 load shedding, DKE1 load shedding, DKW1 load shedding, EE00 load shedding, ES00 load shedding, FI00 load shedding, FR00 load shedding, FR15 load shedding, GB00 load shedding, GBNI load shedding, GR00 load shedding, GR03 load shedding, HR00 load shedding, HU00 load shedding, IE00 load shedding, ITCA load shedding, ITCN load shedding, ITCS load shedding, ITN1 load shedding, ITS1 load shedding, ITSA load shedding, ITSI load shedding, LT00 load shedding, LUB1 load shedding, LUF1 load shedding, LUG1 load shedding, LUV1 load shedding, LV00 load shedding, ME00 load shedding, MK00 load shedding, MT00 load shedding, NL00 load shedding, NOM1 load shedding, NON1 load shedding, NOS0 load shedding, PL00 load shedding, PT00 load shedding, RO00 load shedding, RS00 load shedding, SE01 load shedding, SE02 load shedding, SE03 load shedding, SE04 load shedding, SI00 load shedding, SK00 load shedding, ITCO load shedding, ITVI load shedding
WARNING:scripts.add_electricity:tech_colors for carriers ['none'] not defined in config.

  0%|          | 0/53 [00:00<?, ?it/s]INFO:__main__:Optimizing network for snapshot horizon [2009-01-01 00:00:00:2009-01-07 23:00:00] (1/53).
/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/pypsa/optimization/optimize.py:566: FutureWarning: Passing an int for `transmission_losses` is deprecated and will be removed in PyPSA 2.0. Explicitly pass {'mode': 'tangents', 'segments': 2} (current behavior) or use the new secant-based losses via `transmission_losses=True`.
  m = n.optimize.create_model(
INFO:linopy.model: Solve problem using Gurobi solver
INFO:linopy.model:Solver logs written to `results/tyndp/NT/logs/cba/reference/reference_2030_solver.log`.
INFO:linopy.model:Solver options:
 - threads: 32
 - method: 1
 - NodeMethod: 1
 - Seed: 123
 - AggFill: 0
 - PreDual: 0
 - FeasibilityTol: 1e-06
 - OptimalityTol: 1e-06
 - ScaleFlag: -1
Set parameter WLSAccessID
Set parameter WLSSecret
Set parameter LicenseID to value 2464355
WLS license 2464355 - registered to Open Energy Transition GmbH
Warning for adding constraints: zero or small (< 1e-13) coefficients, ignored
Set parameter Threads to value 32
Set parameter Method to value 1
Set parameter NodeMethod to value 1
Set parameter Seed to value 123
Set parameter AggFill to value 0
Set parameter PreDual to value 0
Set parameter FeasibilityTol to value 1e-06
Set parameter OptimalityTol to value 1e-06
Set parameter ScaleFlag to value -1
Set parameter LogFile to value "/scratch/htc-panfs/mmeng/open-tyndp/results/tyndp/NT/logs/cba/reference/reference_2030_solver.log"
Gurobi Optimizer version 13.0.2 build v13.0.2rc1 (linux64 - "Debian GNU/Linux 13 (trixie)")

CPU model: Intel(R) Xeon(R) Gold 6338 CPU @ 2.00GHz, instruction set [SSE2|AVX|AVX2|AVX512]
Thread count: 64 physical cores, 128 logical processors, using up to 8 threads

Non-default parameters:
Method  1
NodeMethod  1
AggFill  0
PreDual  0
Seed  123
Threads  32

WLS license 2464355 - registered to Open Energy Transition GmbH
Optimize a model with 783062 rows, 397320 columns and 1391514 nonzeros (Min)
Model fingerprint: 0x6020b2ae
Model has 360528 linear objective coefficients
Coefficient statistics:
  Matrix range     [1e-02, 1e+00]
  Objective range  [9e-03, 1e+05]
  Bounds range     [3e+00, 2e+03]
  RHS range        [1e-02, 2e+09]
Warning: Model contains large rhs
         Consider reformulating model or setting NumericFocus parameter
         to avoid numerical issues.

Presolve time: 0.79s
Presolved: 30773 rows, 227643 columns, 383073 nonzeros

Iteration    Objective       Primal Inf.    Dual Inf.      Time
       0    6.5506517e+09   2.839106e+07   0.000000e+00      1s

Extra simplex iterations after uncrush: 168
   55188    1.2026235e+10   0.000000e+00   0.000000e+00      3s

Solved in 55188 iterations and 2.98 seconds (3.10 work units)
Optimal objective  1.202623498e+10
Warning: environment still referenced so free is deferred (Continue to use WLS)
INFO:linopy.constants: Optimization successful: 
Status: ok
Termination condition: optimal
Solution: 397320 primals, 783062 duals
Objective: 1.20e+10
Solver model: available
Solver message: 2


  2%|| 1/53 [00:31<27:26, 31.66s/it]INFO:__main__:Optimizing network for snapshot horizon [2009-01-07 23:00:00:2009-01-14 22:00:00] (2/53).
WARNING:pypsa.optimization.constraints:Stores ['AT00 battery', 'BE00 battery', 'DE00 battery', 'DKW1 battery', 'ES00 battery', 'GB00 battery', 'GR00 battery', 'GR03 battery', 'HR00 battery', 'HU00 battery', 'ITCA battery', 'ITCN battery', 'ITN1 battery', 'ITS1 battery', 'ITSA battery', 'ITSI battery', 'LT00 battery', 'LUG1 battery', 'LV00 battery', 'NL00 battery', 'SE01 battery', 'SE02 battery', 'SE03 battery', 'SE04 battery', 'SK00 battery']: Cyclic energy level constraint overrules initial value setting. User-defined e_initial will be ignored.
/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/pypsa/optimization/optimize.py:566: FutureWarning: Passing an int for `transmission_losses` is deprecated and will be removed in PyPSA 2.0. Explicitly pass {'mode': 'tangents', 'segments': 2} (current behavior) or use the new secant-based losses via `transmission_losses=True`.
  m = n.optimize.create_model(
INFO:linopy.model: Solve problem using Gurobi solver
INFO:linopy.model:Solver logs written to `results/tyndp/NT/logs/cba/reference/reference_2030_solver.log`.
INFO:linopy.model:Solver options:
 - threads: 32
 - method: 1
 - NodeMethod: 1
 - Seed: 123
 - AggFill: 0
 - PreDual: 0
 - FeasibilityTol: 1e-06
 - OptimalityTol: 1e-06
 - ScaleFlag: -1
Set parameter WLSAccessID
Set parameter WLSSecret
Set parameter LicenseID to value 2464355
WLS license 2464355 - registered to Open Energy Transition GmbH
Warning for adding constraints: zero or small (< 1e-13) coefficients, ignored
Set parameter Threads to value 32
Set parameter Method to value 1
Set parameter NodeMethod to value 1
Set parameter Seed to value 123
Set parameter AggFill to value 0
Set parameter PreDual to value 0
Set parameter FeasibilityTol to value 1e-06
Set parameter OptimalityTol to value 1e-06
Set parameter ScaleFlag to value -1
Set parameter LogFile to value "/scratch/htc-panfs/mmeng/open-tyndp/results/tyndp/NT/logs/cba/reference/reference_2030_solver.log"
Gurobi Optimizer version 13.0.2 build v13.0.2rc1 (linux64 - "Debian GNU/Linux 13 (trixie)")

CPU model: Intel(R) Xeon(R) Gold 6338 CPU @ 2.00GHz, instruction set [SSE2|AVX|AVX2|AVX512]
Thread count: 64 physical cores, 128 logical processors, using up to 8 threads

Non-default parameters:
Method  1
NodeMethod  1
AggFill  0
PreDual  0
Seed  123
Threads  32

WLS license 2464355 - registered to Open Energy Transition GmbH
Optimize a model with 783098 rows, 397320 columns and 1391514 nonzeros (Min)
Model fingerprint: 0x80994a81
Model has 360528 linear objective coefficients
Coefficient statistics:
  Matrix range     [1e-02, 1e+00]
  Objective range  [9e-03, 1e+05]
  Bounds range     [2e+00, 7e+03]
  RHS range        [6e-03, 2e+09]
Warning: Model contains large rhs
         Consider reformulating model or setting NumericFocus parameter
         to avoid numerical issues.

Presolve time: 0.81s
Presolved: 31102 rows, 228337 columns, 384030 nonzeros

Iteration    Objective       Primal Inf.    Dual Inf.      Time
       0    6.3414690e+09   2.920744e+07   0.000000e+00      1s

Extra simplex iterations after uncrush: 188
   53858    1.1774647e+10   0.000000e+00   0.000000e+00      3s

Solved in 53858 iterations and 2.71 seconds (2.81 work units)
Optimal objective  1.177464656e+10
Warning: environment still referenced so free is deferred (Continue to use WLS)
INFO:linopy.constants: Optimization successful: 
Status: ok
Termination condition: optimal
Solution: 397320 primals, 783098 duals
Objective: 1.18e+10
Solver model: available
Solver message: 2


  4%|| 2/53 [01:02<26:28, 31.15s/it]INFO:__main__:Optimizing network for snapshot horizon [2009-01-14 22:00:00:2009-01-21 21:00:00] (3/53).
WARNING:pypsa.optimization.constraints:Stores ['BG00 battery', 'CH00 battery', 'DKW1 battery', 'ES00 battery', 'FR00 battery', 'GB00 battery', 'GBNI battery', 'GR00 battery', 'GR03 battery', 'IE00 battery', 'ITCA battery', 'ITCN battery', 'ITCS battery', 'ITN1 battery', 'ITS1 battery', 'ITSA battery', 'ITSI battery', 'LV00 battery']: Cyclic energy level constraint overrules initial value setting. User-defined e_initial will be ignored.
/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/pypsa/optimization/optimize.py:566: FutureWarning: Passing an int for `transmission_losses` is deprecated and will be removed in PyPSA 2.0. Explicitly pass {'mode': 'tangents', 'segments': 2} (current behavior) or use the new secant-based losses via `transmission_losses=True`.
  m = n.optimize.create_model(
INFO:linopy.model: Solve problem using Gurobi solver
INFO:linopy.model:Solver logs written to `results/tyndp/NT/logs/cba/reference/reference_2030_solver.log`.
INFO:linopy.model:Solver options:
 - threads: 32
 - method: 1
 - NodeMethod: 1
 - Seed: 123
 - AggFill: 0
 - PreDual: 0
 - FeasibilityTol: 1e-06
 - OptimalityTol: 1e-06
 - ScaleFlag: -1
Set parameter WLSAccessID
Set parameter WLSSecret
Set parameter LicenseID to value 2464355
WLS license 2464355 - registered to Open Energy Transition GmbH
Warning for adding constraints: zero or small (< 1e-13) coefficients, ignored
Set parameter Threads to value 32
Set parameter Method to value 1
Set parameter NodeMethod to value 1
Set parameter Seed to value 123
Set parameter AggFill to value 0
Set parameter PreDual to value 0
Set parameter FeasibilityTol to value 1e-06
Set parameter OptimalityTol to value 1e-06
Set parameter ScaleFlag to value -1
Set parameter LogFile to value "/scratch/htc-panfs/mmeng/open-tyndp/results/tyndp/NT/logs/cba/reference/reference_2030_solver.log"
Gurobi Optimizer version 13.0.2 build v13.0.2rc1 (linux64 - "Debian GNU/Linux 13 (trixie)")

CPU model: Intel(R) Xeon(R) Gold 6338 CPU @ 2.00GHz, instruction set [SSE2|AVX|AVX2|AVX512]
Thread count: 64 physical cores, 128 logical processors, using up to 8 threads

Non-default parameters:
Method  1
NodeMethod  1
AggFill  0
PreDual  0
Seed  123
Threads  32

WLS license 2464355 - registered to Open Energy Transition GmbH
Optimize a model with 783098 rows, 397320 columns and 1391514 nonzeros (Min)
Model fingerprint: 0xdd06f905
Model has 360528 linear objective coefficients
Coefficient statistics:
  Matrix range     [1e-02, 1e+00]
  Objective range  [9e-03, 1e+05]
  Bounds range     [2e+00, 7e+03]
  RHS range        [6e-03, 2e+09]
Warning: Model contains large rhs
         Consider reformulating model or setting NumericFocus parameter
         to avoid numerical issues.

Presolve time: 0.76s
Presolved: 31622 rows, 228835 columns, 384924 nonzeros

Iteration    Objective       Primal Inf.    Dual Inf.      Time
       0    6.2316975e+09   3.048867e+07   0.000000e+00      1s

Extra simplex iterations after uncrush: 168
   57312    1.0806479e+10   0.000000e+00   0.000000e+00      3s

Solved in 57312 iterations and 2.80 seconds (2.90 work units)
Optimal objective  1.080647906e+10
Warning: environment still referenced so free is deferred (Continue to use WLS)
INFO:linopy.constants: Optimization successful: 
Status: ok
Termination condition: optimal
Solution: 397320 primals, 783098 duals
Objective: 1.08e+10
Solver model: available
Solver message: 2

Project t4 (truncated):

[Fri Jun 19 15:52:39 2026]
localrule solve_cba_network:
    input: resources/tyndp/NT/cba/networks/project_t4_2030.nc
    output: results/tyndp/NT/cba/networks/project_t4_2030.nc
    log: results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log, results/tyndp/NT/logs/cba/projects/project_t4_2030_memory.log, results/tyndp/NT/logs/cba/projects/project_t4_2030_python.log
    jobid: 0
    reason: Forced execution
    wildcards: run=NT, cba_project=t4, planning_horizons=2030
    resources: mem_mb=40000, mem_mib=38147, disk_mb=8000, disk_mib=7630, tmpdir=/scratch/local, runtime=60, partition=big
getfattr: Removing leading '/' from absolute path names
INFO:pypsa.network.io:New version 1.2.3 available! (Current: 1.2.1)
INFO:pypsa.network.io:Imported network 'PyPSA-Eur (tyndp)' has buses, carriers, generators, global_constraints, links, loads, shapes, storage_units, stores, sub_networks
INFO:scripts.solve_network:Add load shedding for all carriers.
WARNING:pypsa.network.io:The following generators are already defined and will be skipped (use overwrite=True to overwrite): AL H2 load shedding, AT H2 load shedding, BA H2 load shedding, BE H2 load shedding, BG H2 load shedding, CH H2 load shedding, CY H2 load shedding, CZ H2 load shedding, DE H2 load shedding, DK H2 load shedding, EE H2 load shedding, ES H2 load shedding, FI H2 load shedding, FR H2 load shedding, GB H2 load shedding, GR H2 load shedding, HR H2 load shedding, HU H2 load shedding, IE H2 load shedding, IT H2 load shedding, LT H2 load shedding, LU H2 load shedding, LV H2 load shedding, ME H2 load shedding, MK H2 load shedding, MT H2 load shedding, NL H2 load shedding, NO H2 load shedding, PL H2 load shedding, PT H2 load shedding, RO H2 load shedding, RS H2 load shedding, SE H2 load shedding, SI H2 load shedding, SK H2 load shedding, IBIT H2 load shedding, IBFI H2 load shedding
WARNING:pypsa.network.io:The following generators are already defined and will be skipped (use overwrite=True to overwrite): AL00 load shedding, AT00 load shedding, BA00 load shedding, BE00 load shedding, BG00 load shedding, CH00 load shedding, CY00 load shedding, CZ00 load shedding, DE00 load shedding, DKE1 load shedding, DKW1 load shedding, EE00 load shedding, ES00 load shedding, FI00 load shedding, FR00 load shedding, FR15 load shedding, GB00 load shedding, GBNI load shedding, GR00 load shedding, GR03 load shedding, HR00 load shedding, HU00 load shedding, IE00 load shedding, ITCA load shedding, ITCN load shedding, ITCS load shedding, ITN1 load shedding, ITS1 load shedding, ITSA load shedding, ITSI load shedding, LT00 load shedding, LUB1 load shedding, LUF1 load shedding, LUG1 load shedding, LUV1 load shedding, LV00 load shedding, ME00 load shedding, MK00 load shedding, MT00 load shedding, NL00 load shedding, NOM1 load shedding, NON1 load shedding, NOS0 load shedding, PL00 load shedding, PT00 load shedding, RO00 load shedding, RS00 load shedding, SE01 load shedding, SE02 load shedding, SE03 load shedding, SE04 load shedding, SI00 load shedding, SK00 load shedding, ITCO load shedding, ITVI load shedding
WARNING:scripts.add_electricity:tech_colors for carriers ['none'] not defined in config.

  0%|          | 0/53 [00:00<?, ?it/s]INFO:__main__:Optimizing network for snapshot horizon [2009-01-01 00:00:00:2009-01-07 23:00:00] (1/53).
/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/pypsa/optimization/optimize.py:566: FutureWarning: Passing an int for `transmission_losses` is deprecated and will be removed in PyPSA 2.0. Explicitly pass {'mode': 'tangents', 'segments': 2} (current behavior) or use the new secant-based losses via `transmission_losses=True`.
  m = n.optimize.create_model(
INFO:linopy.model: Solve problem using Gurobi solver
INFO:linopy.model:Solver logs written to `results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log`.
INFO:linopy.model:Solver options:
 - threads: 32
 - method: 1
 - NodeMethod: 1
 - Seed: 123
 - AggFill: 0
 - PreDual: 0
 - FeasibilityTol: 1e-06
 - OptimalityTol: 1e-06
 - ScaleFlag: -1
Set parameter WLSAccessID
Set parameter WLSSecret
Set parameter LicenseID to value 2464355
WLS license 2464355 - registered to Open Energy Transition GmbH
Warning for adding constraints: zero or small (< 1e-13) coefficients, ignored
Set parameter Threads to value 32
Set parameter Method to value 1
Set parameter NodeMethod to value 1
Set parameter Seed to value 123
Set parameter AggFill to value 0
Set parameter PreDual to value 0
Set parameter FeasibilityTol to value 1e-06
Set parameter OptimalityTol to value 1e-06
Set parameter ScaleFlag to value -1
Set parameter LogFile to value "/scratch/htc-panfs/mmeng/open-tyndp/results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log"
Gurobi Optimizer version 13.0.2 build v13.0.2rc1 (linux64 - "Debian GNU/Linux 13 (trixie)")

CPU model: AMD EPYC 7542 32-Core Processor, instruction set [SSE2|AVX|AVX2]
Thread count: 64 physical cores, 128 logical processors, using up to 8 threads

Non-default parameters:
Method  1
NodeMethod  1
AggFill  0
PreDual  0
Seed  123
Threads  32

WLS license 2464355 - registered to Open Energy Transition GmbH
Optimize a model with 783062 rows, 397320 columns and 1391514 nonzeros (Min)
Model fingerprint: 0xc7fce7a4
Model has 360528 linear objective coefficients
Coefficient statistics:
  Matrix range     [1e-02, 1e+00]
  Objective range  [9e-03, 1e+05]
  Bounds range     [3e+00, 2e+03]
  RHS range        [1e-02, 2e+09]
Warning: Model contains large rhs
         Consider reformulating model or setting NumericFocus parameter
         to avoid numerical issues.

Presolve time: 0.84s
Presolved: 30773 rows, 227643 columns, 383073 nonzeros

Iteration    Objective       Primal Inf.    Dual Inf.      Time
       0    6.5506517e+09   2.839106e+07   0.000000e+00      1s

Extra simplex iterations after uncrush: 168
   55807    1.2026253e+10   0.000000e+00   0.000000e+00      3s

Solved in 55807 iterations and 3.12 seconds (3.13 work units)
Optimal objective  1.202625323e+10
Warning: environment still referenced so free is deferred (Continue to use WLS)
INFO:linopy.constants: Optimization successful: 
Status: ok
Termination condition: optimal
Solution: 397320 primals, 783062 duals
Objective: 1.20e+10
Solver model: available
Solver message: 2


  2%|| 1/53 [00:29<25:26, 29.36s/it]INFO:__main__:Optimizing network for snapshot horizon [2009-01-07 23:00:00:2009-01-14 22:00:00] (2/53).
WARNING:pypsa.optimization.constraints:Stores ['AT00 battery', 'BE00 battery', 'BG00 battery', 'DE00 battery', 'DKW1 battery', 'ES00 battery', 'GB00 battery', 'GBNI battery', 'GR00 battery', 'HU00 battery', 'ITCA battery', 'ITN1 battery', 'ITSA battery', 'ITSI battery', 'LT00 battery', 'LUG1 battery', 'LV00 battery', 'NL00 battery', 'RO00 battery', 'SE01 battery', 'SE02 battery', 'SE03 battery', 'SE04 battery', 'SK00 battery']: Cyclic energy level constraint overrules initial value setting. User-defined e_initial will be ignored.
/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/pypsa/optimization/optimize.py:566: FutureWarning: Passing an int for `transmission_losses` is deprecated and will be removed in PyPSA 2.0. Explicitly pass {'mode': 'tangents', 'segments': 2} (current behavior) or use the new secant-based losses via `transmission_losses=True`.
  m = n.optimize.create_model(
INFO:linopy.model: Solve problem using Gurobi solver
INFO:linopy.model:Solver logs written to `results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log`.
INFO:linopy.model:Solver options:
 - threads: 32
 - method: 1
 - NodeMethod: 1
 - Seed: 123
 - AggFill: 0
 - PreDual: 0
 - FeasibilityTol: 1e-06
 - OptimalityTol: 1e-06
 - ScaleFlag: -1
Set parameter WLSAccessID
Set parameter WLSSecret
Set parameter LicenseID to value 2464355
WLS license 2464355 - registered to Open Energy Transition GmbH
Warning for adding constraints: zero or small (< 1e-13) coefficients, ignored
Set parameter Threads to value 32
Set parameter Method to value 1
Set parameter NodeMethod to value 1
Set parameter Seed to value 123
Set parameter AggFill to value 0
Set parameter PreDual to value 0
Set parameter FeasibilityTol to value 1e-06
Set parameter OptimalityTol to value 1e-06
Set parameter ScaleFlag to value -1
Set parameter LogFile to value "/scratch/htc-panfs/mmeng/open-tyndp/results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log"
Gurobi Optimizer version 13.0.2 build v13.0.2rc1 (linux64 - "Debian GNU/Linux 13 (trixie)")

CPU model: AMD EPYC 7542 32-Core Processor, instruction set [SSE2|AVX|AVX2]
Thread count: 64 physical cores, 128 logical processors, using up to 8 threads

Non-default parameters:
Method  1
NodeMethod  1
AggFill  0
PreDual  0
Seed  123
Threads  32

WLS license 2464355 - registered to Open Energy Transition GmbH
Optimize a model with 783098 rows, 397320 columns and 1391514 nonzeros (Min)
Model fingerprint: 0xd9598b46
Model has 360528 linear objective coefficients
Coefficient statistics:
  Matrix range     [1e-02, 1e+00]
  Objective range  [9e-03, 1e+05]
  Bounds range     [2e+00, 7e+03]
  RHS range        [6e-03, 2e+09]
Warning: Model contains large rhs
         Consider reformulating model or setting NumericFocus parameter
         to avoid numerical issues.

Presolve time: 0.82s
Presolved: 31101 rows, 228336 columns, 384028 nonzeros

Iteration    Objective       Primal Inf.    Dual Inf.      Time
       0    6.3455365e+09   2.919759e+07   0.000000e+00      1s

Extra simplex iterations after uncrush: 203
   54152    1.1775352e+10   0.000000e+00   0.000000e+00      3s

Solved in 54152 iterations and 2.79 seconds (2.79 work units)
Optimal objective  1.177535153e+10
Warning: environment still referenced so free is deferred (Continue to use WLS)
INFO:linopy.constants: Optimization successful: 
Status: ok
Termination condition: optimal
Solution: 397320 primals, 783098 duals
Objective: 1.18e+10
Solver model: available
Solver message: 2


  4%|| 2/53 [00:56<24:01, 28.26s/it]INFO:__main__:Optimizing network for snapshot horizon [2009-01-14 22:00:00:2009-01-21 21:00:00] (3/53).
WARNING:pypsa.optimization.constraints:Stores ['BG00 battery', 'CH00 battery', 'DKW1 battery', 'ES00 battery', 'FR00 battery', 'GB00 battery', 'GBNI battery', 'GR00 battery', 'GR03 battery', 'IE00 battery', 'ITCA battery', 'ITCN battery', 'ITCS battery', 'ITN1 battery', 'ITS1 battery', 'ITSA battery', 'ITSI battery', 'LV00 battery']: Cyclic energy level constraint overrules initial value setting. User-defined e_initial will be ignored.
/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/pypsa/optimization/optimize.py:566: FutureWarning: Passing an int for `transmission_losses` is deprecated and will be removed in PyPSA 2.0. Explicitly pass {'mode': 'tangents', 'segments': 2} (current behavior) or use the new secant-based losses via `transmission_losses=True`.
  m = n.optimize.create_model(
INFO:linopy.model: Solve problem using Gurobi solver
INFO:linopy.model:Solver logs written to `results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log`.
INFO:linopy.model:Solver options:
 - threads: 32
 - method: 1
 - NodeMethod: 1
 - Seed: 123
 - AggFill: 0
 - PreDual: 0
 - FeasibilityTol: 1e-06
 - OptimalityTol: 1e-06
 - ScaleFlag: -1
Set parameter WLSAccessID
Set parameter WLSSecret
Set parameter LicenseID to value 2464355
WLS license 2464355 - registered to Open Energy Transition GmbH
Warning for adding constraints: zero or small (< 1e-13) coefficients, ignored
Set parameter Threads to value 32
Set parameter Method to value 1
Set parameter NodeMethod to value 1
Set parameter Seed to value 123
Set parameter AggFill to value 0
Set parameter PreDual to value 0
Set parameter FeasibilityTol to value 1e-06
Set parameter OptimalityTol to value 1e-06
Set parameter ScaleFlag to value -1
Set parameter LogFile to value "/scratch/htc-panfs/mmeng/open-tyndp/results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log"
Gurobi Optimizer version 13.0.2 build v13.0.2rc1 (linux64 - "Debian GNU/Linux 13 (trixie)")

CPU model: AMD EPYC 7542 32-Core Processor, instruction set [SSE2|AVX|AVX2]
Thread count: 64 physical cores, 128 logical processors, using up to 8 threads

Non-default parameters:
Method  1
NodeMethod  1
AggFill  0
PreDual  0
Seed  123
Threads  32

WLS license 2464355 - registered to Open Energy Transition GmbH
Optimize a model with 783098 rows, 397320 columns and 1391514 nonzeros (Min)
Model fingerprint: 0xf5ab51e9
Model has 360528 linear objective coefficients
Coefficient statistics:
  Matrix range     [1e-02, 1e+00]
  Objective range  [9e-03, 1e+05]
  Bounds range     [2e+00, 7e+03]
  RHS range        [6e-03, 2e+09]
Warning: Model contains large rhs
         Consider reformulating model or setting NumericFocus parameter
         to avoid numerical issues.

Presolve time: 0.80s
Presolved: 31622 rows, 228834 columns, 384923 nonzeros

Iteration    Objective       Primal Inf.    Dual Inf.      Time
       0    6.2394080e+09   3.048034e+07   0.000000e+00      1s

Extra simplex iterations after uncrush: 168
   57362    1.0806776e+10   0.000000e+00   0.000000e+00      3s

Solved in 57362 iterations and 2.72 seconds (2.77 work units)
Optimal objective  1.080677613e+10
Warning: environment still referenced so free is deferred (Continue to use WLS)
INFO:linopy.constants: Optimization successful: 
Status: ok
Termination condition: optimal
Solution: 397320 primals, 783098 duals
Objective: 1.08e+10
Solver model: available
Solver message: 2

Project t16 (truncated):

[Fri Jun 19 15:53:14 2026]
localrule solve_cba_network:
    input: resources/tyndp/NT/cba/networks/project_t16_2030.nc
    output: results/tyndp/NT/cba/networks/project_t16_2030.nc
    log: results/tyndp/NT/logs/cba/projects/project_t16_2030_solver.log, results/tyndp/NT/logs/cba/projects/project_t16_2030_memory.log, results/tyndp/NT/logs/cba/projects/project_t16_2030_python.log
    jobid: 0
    reason: Forced execution
    wildcards: run=NT, cba_project=t16, planning_horizons=2030
    resources: mem_mb=40000, mem_mib=38147, disk_mb=8000, disk_mib=7630, tmpdir=/scratch/local, runtime=60, partition=big
getfattr: Removing leading '/' from absolute path names
INFO:pypsa.network.io:New version 1.2.3 available! (Current: 1.2.1)
INFO:pypsa.network.io:Imported network 'PyPSA-Eur (tyndp)' has buses, carriers, generators, global_constraints, links, loads, shapes, storage_units, stores, sub_networks
INFO:scripts.solve_network:Add load shedding for all carriers.
WARNING:pypsa.network.io:The following generators are already defined and will be skipped (use overwrite=True to overwrite): AL H2 load shedding, AT H2 load shedding, BA H2 load shedding, BE H2 load shedding, BG H2 load shedding, CH H2 load shedding, CY H2 load shedding, CZ H2 load shedding, DE H2 load shedding, DK H2 load shedding, EE H2 load shedding, ES H2 load shedding, FI H2 load shedding, FR H2 load shedding, GB H2 load shedding, GR H2 load shedding, HR H2 load shedding, HU H2 load shedding, IE H2 load shedding, IT H2 load shedding, LT H2 load shedding, LU H2 load shedding, LV H2 load shedding, ME H2 load shedding, MK H2 load shedding, MT H2 load shedding, NL H2 load shedding, NO H2 load shedding, PL H2 load shedding, PT H2 load shedding, RO H2 load shedding, RS H2 load shedding, SE H2 load shedding, SI H2 load shedding, SK H2 load shedding, IBIT H2 load shedding, IBFI H2 load shedding
WARNING:pypsa.network.io:The following generators are already defined and will be skipped (use overwrite=True to overwrite): AL00 load shedding, AT00 load shedding, BA00 load shedding, BE00 load shedding, BG00 load shedding, CH00 load shedding, CY00 load shedding, CZ00 load shedding, DE00 load shedding, DKE1 load shedding, DKW1 load shedding, EE00 load shedding, ES00 load shedding, FI00 load shedding, FR00 load shedding, FR15 load shedding, GB00 load shedding, GBNI load shedding, GR00 load shedding, GR03 load shedding, HR00 load shedding, HU00 load shedding, IE00 load shedding, ITCA load shedding, ITCN load shedding, ITCS load shedding, ITN1 load shedding, ITS1 load shedding, ITSA load shedding, ITSI load shedding, LT00 load shedding, LUB1 load shedding, LUF1 load shedding, LUG1 load shedding, LUV1 load shedding, LV00 load shedding, ME00 load shedding, MK00 load shedding, MT00 load shedding, NL00 load shedding, NOM1 load shedding, NON1 load shedding, NOS0 load shedding, PL00 load shedding, PT00 load shedding, RO00 load shedding, RS00 load shedding, SE01 load shedding, SE02 load shedding, SE03 load shedding, SE04 load shedding, SI00 load shedding, SK00 load shedding, ITCO load shedding, ITVI load shedding
WARNING:scripts.add_electricity:tech_colors for carriers ['none'] not defined in config.

  0%|          | 0/53 [00:00<?, ?it/s]INFO:__main__:Optimizing network for snapshot horizon [2009-01-01 00:00:00:2009-01-07 23:00:00] (1/53).
/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/pypsa/optimization/optimize.py:566: FutureWarning: Passing an int for `transmission_losses` is deprecated and will be removed in PyPSA 2.0. Explicitly pass {'mode': 'tangents', 'segments': 2} (current behavior) or use the new secant-based losses via `transmission_losses=True`.
  m = n.optimize.create_model(
INFO:linopy.model: Solve problem using Gurobi solver
INFO:linopy.model:Solver logs written to `results/tyndp/NT/logs/cba/projects/project_t16_2030_solver.log`.
INFO:linopy.model:Solver options:
 - threads: 32
 - method: 1
 - NodeMethod: 1
 - Seed: 123
 - AggFill: 0
 - PreDual: 0
 - FeasibilityTol: 1e-06
 - OptimalityTol: 1e-06
 - ScaleFlag: -1
Set parameter WLSAccessID
Set parameter WLSSecret
Set parameter LicenseID to value 2464355
WLS license 2464355 - registered to Open Energy Transition GmbH
Warning for adding constraints: zero or small (< 1e-13) coefficients, ignored
Set parameter Threads to value 32
Set parameter Method to value 1
Set parameter NodeMethod to value 1
Set parameter Seed to value 123
Set parameter AggFill to value 0
Set parameter PreDual to value 0
Set parameter FeasibilityTol to value 1e-06
Set parameter OptimalityTol to value 1e-06
Set parameter ScaleFlag to value -1
Set parameter LogFile to value "/scratch/htc-panfs/mmeng/open-tyndp/results/tyndp/NT/logs/cba/projects/project_t16_2030_solver.log"
Gurobi Optimizer version 13.0.2 build v13.0.2rc1 (linux64 - "Debian GNU/Linux 13 (trixie)")

CPU model: Intel(R) Xeon(R) Gold 6338 CPU @ 2.00GHz, instruction set [SSE2|AVX|AVX2|AVX512]
Thread count: 64 physical cores, 128 logical processors, using up to 8 threads

Non-default parameters:
Method  1
NodeMethod  1
AggFill  0
PreDual  0
Seed  123
Threads  32

WLS license 2464355 - registered to Open Energy Transition GmbH
Optimize a model with 783062 rows, 397320 columns and 1391514 nonzeros (Min)
Model fingerprint: 0x4a25adb3
Model has 360528 linear objective coefficients
Coefficient statistics:
  Matrix range     [1e-02, 1e+00]
  Objective range  [9e-03, 1e+05]
  Bounds range     [3e+00, 2e+03]
  RHS range        [1e-02, 2e+09]
Warning: Model contains large rhs
         Consider reformulating model or setting NumericFocus parameter
         to avoid numerical issues.

Presolve time: 2.59s
Presolved: 30773 rows, 227643 columns, 383073 nonzeros

Iteration    Objective       Primal Inf.    Dual Inf.      Time
       0    6.5506517e+09   2.839106e+07   0.000000e+00      3s
   23946    1.1007021e+10   1.828464e+07   0.000000e+00      5s

Extra simplex iterations after uncrush: 168
   55256    1.2039546e+10   0.000000e+00   0.000000e+00     10s

Solved in 55256 iterations and 10.15 seconds (3.15 work units)
Optimal objective  1.203954636e+10
Warning: environment still referenced so free is deferred (Continue to use WLS)
INFO:linopy.constants: Optimization successful: 
Status: ok
Termination condition: optimal
Solution: 397320 primals, 783062 duals
Objective: 1.20e+10
Solver model: available
Solver message: 2


  2%|| 1/53 [01:45<1:31:35, 105.69s/it]INFO:__main__:Optimizing network for snapshot horizon [2009-01-07 23:00:00:2009-01-14 22:00:00] (2/53).
WARNING:pypsa.optimization.constraints:Stores ['BE00 battery', 'BG00 battery', 'DE00 battery', 'DKW1 battery', 'ES00 battery', 'GB00 battery', 'GBNI battery', 'HR00 battery', 'HU00 battery', 'ITCA battery', 'ITCN battery', 'ITSA battery', 'ITSI battery', 'LT00 battery', 'LV00 battery', 'NL00 battery', 'SE02 battery', 'SE03 battery', 'SE04 battery', 'SK00 battery']: Cyclic energy level constraint overrules initial value setting. User-defined e_initial will be ignored.
/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/pypsa/optimization/optimize.py:566: FutureWarning: Passing an int for `transmission_losses` is deprecated and will be removed in PyPSA 2.0. Explicitly pass {'mode': 'tangents', 'segments': 2} (current behavior) or use the new secant-based losses via `transmission_losses=True`.
  m = n.optimize.create_model(
INFO:linopy.model: Solve problem using Gurobi solver
INFO:linopy.model:Solver logs written to `results/tyndp/NT/logs/cba/projects/project_t16_2030_solver.log`.
INFO:linopy.model:Solver options:
 - threads: 32
 - method: 1
 - NodeMethod: 1
 - Seed: 123
 - AggFill: 0
 - PreDual: 0
 - FeasibilityTol: 1e-06
 - OptimalityTol: 1e-06
 - ScaleFlag: -1
Set parameter WLSAccessID
Set parameter WLSSecret
Set parameter LicenseID to value 2464355
WLS license 2464355 - registered to Open Energy Transition GmbH
Warning for adding constraints: zero or small (< 1e-13) coefficients, ignored
Set parameter Threads to value 32
Set parameter Method to value 1
Set parameter NodeMethod to value 1
Set parameter Seed to value 123
Set parameter AggFill to value 0
Set parameter PreDual to value 0
Set parameter FeasibilityTol to value 1e-06
Set parameter OptimalityTol to value 1e-06
Set parameter ScaleFlag to value -1
Set parameter LogFile to value "/scratch/htc-panfs/mmeng/open-tyndp/results/tyndp/NT/logs/cba/projects/project_t16_2030_solver.log"
Gurobi Optimizer version 13.0.2 build v13.0.2rc1 (linux64 - "Debian GNU/Linux 13 (trixie)")

CPU model: Intel(R) Xeon(R) Gold 6338 CPU @ 2.00GHz, instruction set [SSE2|AVX|AVX2|AVX512]
Thread count: 64 physical cores, 128 logical processors, using up to 8 threads

Non-default parameters:
Method  1
NodeMethod  1
AggFill  0
PreDual  0
Seed  123
Threads  32

WLS license 2464355 - registered to Open Energy Transition GmbH
Optimize a model with 783098 rows, 397320 columns and 1391514 nonzeros (Min)
Model fingerprint: 0xed0b76ac
Model has 360528 linear objective coefficients
Coefficient statistics:
  Matrix range     [1e-02, 1e+00]
  Objective range  [9e-03, 1e+05]
  Bounds range     [2e+00, 7e+03]
  RHS range        [6e-03, 2e+09]
Warning: Model contains large rhs
         Consider reformulating model or setting NumericFocus parameter
         to avoid numerical issues.

Presolve time: 2.51s
Presolved: 31095 rows, 228324 columns, 384010 nonzeros

Iteration    Objective       Primal Inf.    Dual Inf.      Time
       0    6.3518061e+09   2.917438e+07   0.000000e+00      3s
   27036    1.1180756e+10   7.953387e+06   0.000000e+00      5s

Extra simplex iterations after uncrush: 203
   54110    1.1787622e+10   0.000000e+00   0.000000e+00      9s

Solved in 54110 iterations and 9.03 seconds (2.82 work units)
Optimal objective  1.178762213e+10
Warning: environment still referenced so free is deferred (Continue to use WLS)
INFO:linopy.constants: Optimization successful: 
Status: ok
Termination condition: optimal
Solution: 397320 primals, 783098 duals
Objective: 1.18e+10
Solver model: available
Solver message: 2


  4%|| 2/53 [03:27<1:27:55, 103.43s/it]INFO:__main__:Optimizing network for snapshot horizon [2009-01-14 22:00:00:2009-01-21 21:00:00] (3/53).
WARNING:pypsa.optimization.constraints:Stores ['BG00 battery', 'CH00 battery', 'DKW1 battery', 'FR00 battery', 'GB00 battery', 'GBNI battery', 'GR00 battery', 'GR03 battery', 'IE00 battery', 'ITCA battery', 'ITCN battery', 'ITCS battery', 'ITN1 battery', 'ITS1 battery', 'ITSA battery', 'ITSI battery', 'LV00 battery']: Cyclic energy level constraint overrules initial value setting. User-defined e_initial will be ignored.
/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/pypsa/optimization/optimize.py:566: FutureWarning: Passing an int for `transmission_losses` is deprecated and will be removed in PyPSA 2.0. Explicitly pass {'mode': 'tangents', 'segments': 2} (current behavior) or use the new secant-based losses via `transmission_losses=True`.
  m = n.optimize.create_model(
INFO:linopy.model: Solve problem using Gurobi solver
INFO:linopy.model:Solver logs written to `results/tyndp/NT/logs/cba/projects/project_t16_2030_solver.log`.
INFO:linopy.model:Solver options:
 - threads: 32
 - method: 1
 - NodeMethod: 1
 - Seed: 123
 - AggFill: 0
 - PreDual: 0
 - FeasibilityTol: 1e-06
 - OptimalityTol: 1e-06
 - ScaleFlag: -1
Set parameter WLSAccessID
Set parameter WLSSecret
Set parameter LicenseID to value 2464355
WLS license 2464355 - registered to Open Energy Transition GmbH
Warning for adding constraints: zero or small (< 1e-13) coefficients, ignored
Set parameter Threads to value 32
Set parameter Method to value 1
Set parameter NodeMethod to value 1
Set parameter Seed to value 123
Set parameter AggFill to value 0
Set parameter PreDual to value 0
Set parameter FeasibilityTol to value 1e-06
Set parameter OptimalityTol to value 1e-06
Set parameter ScaleFlag to value -1
Set parameter LogFile to value "/scratch/htc-panfs/mmeng/open-tyndp/results/tyndp/NT/logs/cba/projects/project_t16_2030_solver.log"
Gurobi Optimizer version 13.0.2 build v13.0.2rc1 (linux64 - "Debian GNU/Linux 13 (trixie)")

CPU model: Intel(R) Xeon(R) Gold 6338 CPU @ 2.00GHz, instruction set [SSE2|AVX|AVX2|AVX512]
Thread count: 64 physical cores, 128 logical processors, using up to 8 threads

Non-default parameters:
Method  1
NodeMethod  1
AggFill  0
PreDual  0
Seed  123
Threads  32

WLS license 2464355 - registered to Open Energy Transition GmbH
Optimize a model with 783098 rows, 397320 columns and 1391514 nonzeros (Min)
Model fingerprint: 0xeacaba11
Model has 360528 linear objective coefficients
Coefficient statistics:
  Matrix range     [1e-02, 1e+00]
  Objective range  [9e-03, 1e+05]
  Bounds range     [2e+00, 7e+03]
  RHS range        [6e-03, 2e+09]
Warning: Model contains large rhs
         Consider reformulating model or setting NumericFocus parameter
         to avoid numerical issues.

Presolve time: 2.57s
Presolved: 31622 rows, 228835 columns, 384924 nonzeros

Iteration    Objective       Primal Inf.    Dual Inf.      Time
       0    6.2412922e+09   3.037248e+07   0.000000e+00      3s
   30486    1.0324041e+10   7.432152e+06   0.000000e+00      5s

Extra simplex iterations after uncrush: 168
   57638    1.0814268e+10   0.000000e+00   0.000000e+00      9s

Solved in 57638 iterations and 9.11 seconds (2.85 work units)
Optimal objective  1.081426768e+10
Warning: environment still referenced so free is deferred (Continue to use WLS)
INFO:linopy.constants: Optimization successful: 
Status: ok
Termination condition: optimal
Solution: 397320 primals, 783098 duals
Objective: 1.08e+10
Solver model: available
Solver message: 2

Workflow should fail if rolling horizon is infeasible when using HiGHS

Again, I tested this using a similar config file called config/config.zib.yaml and running snakemake --profile profiles/slurm -call cba --configfile config/config.tyndp.yaml config/config.zib.yaml.

The config file looks like:

Details
run:
  name: "NT"

clustering:
  temporal:
    resolution_sector: 1H

solving:
  options:
    assign_all_duals: true
    include_objective_constant: false
  solver:
    name: gurobi
    options: gurobi-default
  partition: big
  mem_mb: 40000
  runtime: 1h

cba:
  planning_horizons:
  - 2030

  projects: [t4, t16]

  msv_extraction:
    solving:
      options:
        include_objective_constant: false
      solver:
        name: gurobi
        options: gurobi-default
      solver_options:
        gurobi-default:
          BarConvTol: 1.0e-06
      partition: big
      mem_mb: 40000
      runtime: 1h

  # Rolling horizon solving settings
  solving:
    options:
      include_objective_constant: false
    partition: big
    mem_mb: 40000
    runtime: 1h

    solver:
      name: highs
      options: highs-simplex

    solver_options:
      highs-simplex:
        primal_feasibility_tolerance: 1.0e-06
        dual_feasibility_tolerance: 1.0e-06

Currently, on the master branch, the rolling horizon optimization for the CBA projects fail due to infeasibilities in the later horizons. When using HiGHS, this is how a project's solve log looks:

Details
 92%|█████████▏| 49/53 [31:05<02:29, 37.46s/it]INFO:__main__:Optimizing network for snapshot horizon [2009-12-07 23:00:00:2009-12-14 22:00:00] (50/53).
WARNING:pypsa.optimization.constraints:Stores ['BE00 battery', 'DKW1 battery', 'FR00 battery', 'GB00 battery', 'GBNI battery', 'IE00 battery', 'LV00 battery', 'NL00 battery']: Cyclic energy level constraint overrules initial value setting. User-defined e_initial will be ignored.
/scratch/htc-panfs/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/pypsa/optimization/optimize.py:566: FutureWarning: Passing an int for `transmission_losses` is deprecated and will be removed in PyPSA 2.0. Explicitly pass {'mode': 'tangents', 'segments': 2} (current behavior) or use the new secant-based losses via `transmission_losses=True`.
  m = n.optimize.create_model(
INFO:linopy.model: Solve problem using Highs solver
INFO:linopy.model:Solver logs written to `results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log`.
INFO:linopy.model:Solver options:
 - solver: simplex
 - parallel: off
 - primal_feasibility_tolerance: 1e-06
 - dual_feasibility_tolerance: 1e-06
 - random_seed: 123
Running HiGHS 1.14.0 (git hash: n/a): Copyright (c) 2026 under MIT licence terms
INFO:linopy.solvers:Log file at /scratch/htc-panfs/mmeng/open-tyndp/results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log
LP has 783098 rows; 397320 cols; 1391514 nonzeros
Coefficient ranges:
  Matrix  [1e-02, 1e+00]
  Cost    [9e-03, 1e+05]
  Bound   [9e-01, 5e+03]
  RHS     [1e-02, 2e+09]
WARNING: Problem has some excessively large row bounds
WARNING:    Consider scaling the    bounds by 1e-4, or setting the user_bound_scale option to -12
Presolving model
60590 rows, 295407 cols, 557750 nonzeros 0s
39503 rows, 245157 cols, 409806 nonzeros 2s
Dependent equations search running on 34515 equations with time limit of 1000.00s
Dependent equations search removed 0 rows and 0 nonzeros in 0.01s (limit = 1000.00s)
34769 rows, 235418 cols, 395000 nonzeros 14s
Presolve reductions: rows 34769(-748329); columns 235418(-161902); nonzeros 395000(-996514) 
Solving the presolved LP
Using dual simplex solver
  Iteration        Objective     Infeasibilities num(sum)
          0     0.0000000000e+00 Ph1: 0(0) 15.0s
      25577     1.1093422913e+10 16.0s
Model status        : Infeasible
Simplex   iterations: 25577
Objective value     :  1.1159740885e+10
HiGHS run time      :         16.00
WARNING:linopy.constants:Optimization potentially failed: 
Status: warning
Termination condition: infeasible
Solution: 0 primals, 0 duals
Objective: nan
Solver model: available
Solver message: Infeasible

WARNING:__main__:Optimization failed with status warning and condition infeasible
WARNING:__main__:Fallback also failed: warning / infeasible

 92%|█████████▏| 49/53 [31:27<02:34, 38.53s/it]
WARNING:__main__:Solving status 'warning' with termination condition 'infeasible'
INFO:__main__:Maximum memory usage: (9230.265625, 1781882316.1444426)
INFO:pypsa.network.io:Exported network 'PyPSA-Eur (tyndp)' saved to 'results/tyndp/NT/cba/networks/project_t4_2030.nc contains: storage_units, buses, loads, global_constraints, stores, generators, links, shapes, carriers
[Fri Jun 19 17:21:01 2026]
Finished jobid: 0 (Rule: solve_cba_network)
1 of 1 steps (100%) done
Storing output in storage.

On master, even though the optimization fails for all projects at the solve_cba_network rule as shown above, the workflow still continues on to the next steps/rules, making it appears as though the entire workflow runs successfully:

Details
(pypsa-eur:open-tyndp) mmeng@htc-login03:/scratch/htc-panfs/mmeng/open-tyndp$ snakemake --profile profiles/slurm -call cba --configfile config/config.tyndp.yaml config/config.zib.yaml
Using profiles profiles/slurm and workflow specific profile profiles/default for setting default command line arguments.
Config file config/config.default.yaml is extended by additional config specified via the command line.
Config file config/plotting.default.yaml is extended by additional config specified via the command line.
Config file config/benchmarking.default.yaml is extended by additional config specified via the command line.
Falling back to greedy scheduler because no ILP solver is found (you have to install pulp and either coincbc or glpk).
host: htc-login03.zib.de
Building DAG of jobs...
Updating checkpoint dependencies.
Using shell: /usr/bin/bash
Provided remote nodes: 999
Conda environments: ignored
Job stats:
job                            count
---------------------------  -------
cba                                1
collect_cba_scenario               1
collect_indicators                 1
make_indicators                    2
plot_cba_benchmark                 2
plot_indicators                    1
solve_cba_network                  2
solve_cba_reference_network        1
total                             11

Select jobs to execute...
Execute 1 jobs...

[Fri Jun 19 16:48:41 2026]
rule solve_cba_network:
    input: resources/tyndp/NT/cba/networks/project_t4_2030.nc
    output: results/tyndp/NT/cba/networks/project_t4_2030.nc
    log: results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log, results/tyndp/NT/logs/cba/projects/project_t4_2030_memory.log, results/tyndp/NT/logs/cba/projects/project_t4_2030_python.log
    jobid: 125
    reason: Missing output files: results/tyndp/NT/cba/networks/project_t4_2030.nc; Updated input files: resources/tyndp/NT/cba/networks/project_t4_2030.nc
    wildcards: run=NT, cba_project=t4, planning_horizons=2030
    resources: mem_mb=40000, mem_mib=38147, disk_mb=8000, disk_mib=7630, tmpdir=<TBD>, runtime=60, partition=big
Submitted job 125 with external jobid 'Submitted batch job 1251594'.
Select jobs to execute...
Execute 1 jobs...

[Fri Jun 19 16:48:51 2026]
rule solve_cba_reference_network:
    input: resources/tyndp/NT/cba/networks/rl_2030.nc
    output: results/tyndp/NT/cba/networks/reference_2030.nc
    log: results/tyndp/NT/logs/cba/reference/reference_2030_solver.log, results/tyndp/NT/logs/cba/reference/reference_2030_memory.log, results/tyndp/NT/logs/cba/reference/reference_2030_python.log
    jobid: 10
    reason: Missing output files: results/tyndp/NT/cba/networks/reference_2030.nc; Updated input files: resources/tyndp/NT/cba/networks/rl_2030.nc
    wildcards: run=NT, planning_horizons=2030
    resources: mem_mb=40000, mem_mib=38147, disk_mb=8000, disk_mib=7630, tmpdir=<TBD>, runtime=60, partition=big
Submitted job 10 with external jobid 'Submitted batch job 1251595'.
Select jobs to execute...
Execute 1 jobs...

[Fri Jun 19 16:49:01 2026]
rule solve_cba_network:
    input: resources/tyndp/NT/cba/networks/project_t16_2030.nc
    output: results/tyndp/NT/cba/networks/project_t16_2030.nc
    log: results/tyndp/NT/logs/cba/projects/project_t16_2030_solver.log, results/tyndp/NT/logs/cba/projects/project_t16_2030_memory.log, results/tyndp/NT/logs/cba/projects/project_t16_2030_python.log
    jobid: 130
    reason: Missing output files: results/tyndp/NT/cba/networks/project_t16_2030.nc; Params have changed since last execution: Union of exclusive params before and now across all output: before: {'horizon': 168, 'overlap': 1, 'options': {'noisy_costs': False, 'load_shedding': {'enable': True, 'apply_to_all_carriers': True}, 'io_api': 'direct', 'include_objective_constant': False}, 'solver': {'name': 'gurobi', 'options': 'gurobi-simplex'}, 'solver_options': {'highs-simplex': {'parallel': 'off'}, 'gurobi-simplex': {'FeasibilityTol': 1e-06, 'OptimalityTol': 1e-06}}, 'partition': 'big', 'mem_mb': 40000, 'runtime': '1h'} now: {'horizon': 168, 'overlap': 1, 'options': {'noisy_costs': False, 'load_shedding': {'enable': True, 'apply_to_all_carriers': True}, 'io_api': 'direct', 'include_objective_constant': False}, 'solver': {'name': 'highs', 'options': 'highs-simplex'}, 'solver_options': {'highs-simplex': {'parallel': 'off', 'primal_feasibility_tolerance': 1e-06, 'dual_feasibility_tolerance': 1e-06}}, 'partition': 'big', 'mem_mb': 40000, 'runtime': '1h'}
    wildcards: run=NT, cba_project=t16, planning_horizons=2030
    resources: mem_mb=40000, mem_mib=38147, disk_mb=8000, disk_mib=7630, tmpdir=<TBD>, runtime=60, partition=big
Submitted job 130 with external jobid 'Submitted batch job 1251596'.
[Fri Jun 19 17:21:03 2026]
Finished jobid: 125 (Rule: solve_cba_network)
1 of 11 steps (9%) done
Removing temporary output resources/tyndp/NT/cba/networks/project_t4_2030.nc.
[Fri Jun 19 17:22:43 2026]
Finished jobid: 10 (Rule: solve_cba_reference_network)
2 of 11 steps (18%) done
Select jobs to execute...
Execute 1 jobs...

[Fri Jun 19 17:22:43 2026]
rule make_indicators:
    input: results/tyndp/NT/cba/networks/reference_2030.nc, results/tyndp/NT/cba/networks/project_t4_2030.nc, data/tyndp_cba_non_co2_emissions/archive/2024/a.3_non-co2-emissions.csv, resources/tyndp/NT/cba/tyndp_indicators.csv, resources/tyndp/NT/cba/cba_project_methods.csv
    output: results/tyndp/NT/cba/project_t4_2030.csv
    jobid: 9
    reason: Input files updated by another job: results/tyndp/NT/cba/networks/project_t4_2030.nc, results/tyndp/NT/cba/networks/reference_2030.nc
    wildcards: run=NT, cba_project=t4, planning_horizons=2030
    resources: mem_mb=40000, mem_mib=38147, disk_mb=8000, disk_mib=7630, tmpdir=<TBD>, runtime=60, partition=big
Submitted job 9 with external jobid 'Submitted batch job 1252042'.
[Fri Jun 19 17:23:13 2026]
Finished jobid: 9 (Rule: make_indicators)
3 of 11 steps (27%) done
Select jobs to execute...
Execute 1 jobs...

[Fri Jun 19 17:23:13 2026]
rule plot_cba_benchmark:
    input: results/tyndp/NT/cba/project_t4_2030.csv
    output: results/tyndp/NT/cba/validation_2030/project_t4_2030.png
    jobid: 132
    reason: Missing output files: results/tyndp/NT/cba/validation_2030/project_t4_2030.png; Input files updated by another job: results/tyndp/NT/cba/project_t4_2030.csv
    wildcards: run=NT, planning_horizons=2030, cba_project=t4
    resources: mem_mb=40000, mem_mib=38147, disk_mb=8000, disk_mib=7630, tmpdir=<TBD>, runtime=60, partition=big
Submitted job 132 with external jobid 'Submitted batch job 1252043'.
[Fri Jun 19 17:23:33 2026]
Finished jobid: 130 (Rule: solve_cba_network)
4 of 11 steps (36%) done
Removing temporary output resources/tyndp/NT/cba/networks/project_t16_2030.nc.
Select jobs to execute...
Execute 1 jobs...

[Fri Jun 19 17:23:33 2026]
rule make_indicators:
    input: results/tyndp/NT/cba/networks/reference_2030.nc, results/tyndp/NT/cba/networks/project_t16_2030.nc, data/tyndp_cba_non_co2_emissions/archive/2024/a.3_non-co2-emissions.csv, resources/tyndp/NT/cba/tyndp_indicators.csv, resources/tyndp/NT/cba/cba_project_methods.csv
    output: results/tyndp/NT/cba/project_t16_2030.csv
    jobid: 129
    reason: Missing output files: results/tyndp/NT/cba/project_t16_2030.csv; Input files updated by another job: results/tyndp/NT/cba/networks/project_t16_2030.nc, results/tyndp/NT/cba/networks/reference_2030.nc
    wildcards: run=NT, cba_project=t16, planning_horizons=2030
    resources: mem_mb=40000, mem_mib=38147, disk_mb=8000, disk_mib=7630, tmpdir=<TBD>, runtime=60, partition=big
Submitted job 129 with external jobid 'Submitted batch job 1252044'.
[Fri Jun 19 17:23:33 2026]
Finished jobid: 132 (Rule: plot_cba_benchmark)
5 of 11 steps (45%) done
[Fri Jun 19 17:24:03 2026]
Finished jobid: 129 (Rule: make_indicators)
6 of 11 steps (55%) done
Select jobs to execute...
Execute 1 jobs...

[Fri Jun 19 17:24:03 2026]
rule collect_indicators:
[Fri Jun 19 17:24:24 2026]
rule plot_indicators:
    input: results/tyndp/NT/cba/indicators_2030.csv, resources/tyndp/NT/cba/transmission_projects.csv
    output: results/tyndp/NT/cba/plots_2030
    jobid: 7
    reason: Missing output files: results/tyndp/NT/cba/plots_2030; Input files updated by another job: results/tyndp/NT/cba/indicators_2030.csv

[Fri Jun 19 17:24:24 2026]
rule plot_indicators:
    input: results/tyndp/NT/cba/indicators_2030.csv, resources/tyndp/NT/cba/transmission_projects.csv
    output: results/tyndp/NT/cba/plots_2030
    jobid: 7
    reason: Missing output files: results/tyndp/NT/cba/plots_2030; Input files updated by another job: results/tyndp/NT/cba/indicators_2030.csv
    wildcards: run=NT, planning_horizons=2030
    resources: mem_mb=40000, mem_mib=38147, disk_mb=8000, disk_mib=7630, tmpdir=<TBD>, runtime=60, partition=big
Submitted job 7 with external jobid 'Submitted batch job 1252048'.
[Fri Jun 19 17:24:33 2026]
Finished jobid: 133 (Rule: plot_cba_benchmark)
8 of 11 steps (73%) done
[Fri Jun 19 17:24:43 2026]
Finished jobid: 7 (Rule: plot_indicators)
9 of 11 steps (82%) done
Select jobs to execute...
Execute 1 jobs...

[Fri Jun 19 17:24:43 2026]
localrule collect_cba_scenario:
    input: results/tyndp/NT/cba/plots_2030, results/tyndp/NT/cba/validation_2030/project_t4_2030.png, results/tyndp/NT/cba/validation_2030/project_t16_2030.png
    output: results/tyndp/NT/cba/all_scenarios.txt
    jobid: 1
    reason: Missing output files: results/tyndp/NT/cba/all_scenarios.txt; Input files updated by another job: results/tyndp/NT/cba/plots_2030, results/tyndp/NT/cba/validation_2030/project_t16_2030.png, results/tyndp/NT/cba/validation_2030/project_t4_2030.png
    wildcards: run=NT
    resources: mem_mb=40000, mem_mib=38147, disk_mb=8000, disk_mib=7630, tmpdir=/scratch/local, runtime=60, partition=big
Touching output file results/tyndp/NT/cba/all_scenarios.txt.
[Fri Jun 19 17:24:43 2026]
Finished jobid: 1 (Rule: collect_cba_scenario)
10 of 11 steps (91%) done
Select jobs to execute...
Job rate limit reached, waiting for free slots.
Execute 1 jobs...

[Fri Jun 19 17:24:53 2026]
localrule cba:
    input: results/tyndp/NT/cba/all_scenarios.txt
    jobid: 0
    reason: Input files updated by another job: results/tyndp/NT/cba/all_scenarios.txt
    resources: mem_mb=40000, mem_mib=38147, disk_mb=8000, disk_mib=7630, tmpdir=/scratch/local, runtime=60, partition=big
[Fri Jun 19 17:24:53 2026]
Finished jobid: 0 (Rule: cba)
11 of 11 steps (100%) done
Complete log(s): /scratch/htc-panfs/mmeng/open-tyndp/.snakemake/log/2026-06-19T164829.560867.snakemake.log

Using the patch on this branch, if a rolling horizon optimization's status is anything that is not 'ok', then an error is raised and the workflow fails.

Thus, when testing on this branch, the same projects' optimizations fail at the solve_cba_network, but this time the workflow also fails:

Details
(pypsa-eur:open-tyndp) mmeng@htc-login03:/scratch/htc-panfs/mmeng/open-tyndp$ snakemake --profile profiles/slurm -call cba --configfile config/config.tyndp.yaml config/config.zib.yaml
Using profiles profiles/slurm and workflow specific profile profiles/default for setting default command line arguments.
Config file config/config.default.yaml is extended by additional config specified via the command line.
Config file config/plotting.default.yaml is extended by additional config specified via the command line.
Config file config/benchmarking.default.yaml is extended by additional config specified via the command line.
Falling back to greedy scheduler because no ILP solver is found (you have to install pulp and either coincbc or glpk).
host: htc-login03.zib.de
Building DAG of jobs...
Updating checkpoint dependencies.
Using shell: /usr/bin/bash
Provided remote nodes: 999
Conda environments: ignored
Job stats:
job                            count
---------------------------  -------
cba                                1
collect_cba_scenario               1
collect_indicators                 1
make_indicators                    2
plot_cba_benchmark                 2
plot_indicators                    1
prepare_project                    2
solve_cba_network                  2
solve_cba_reference_network        1
total                             13

Select jobs to execute...
Execute 1 jobs...

[Fri Jun 19 19:50:19 2026]
rule prepare_project:
    input: resources/tyndp/NT/cba/networks/rl_2030.nc, resources/tyndp/NT/cba/networks/msv_2030.nc, resources/tyndp/NT/cba/transmission_projects.csv, resources/tyndp/NT/cba/storage_projects.csv, resources/tyndp/NT/cba/cba_project_methods.csv, resources/tyndp/NT/costs_2030_processed.csv
    output: resources/tyndp/NT/cba/networks/project_t4_2030.nc
    jobid: 126
    reason: Missing output files: resources/tyndp/NT/cba/networks/project_t4_2030.nc
    wildcards: run=NT, cba_project=t4, planning_horizons=2030
    resources: mem_mb=40000, mem_mib=38147, disk_mb=8000, disk_mib=7630, tmpdir=<TBD>, runtime=60, partition=big
Submitted job 126 with external jobid 'Submitted batch job 1256807'.
Select jobs to execute...
Execute 1 jobs...

[Fri Jun 19 19:50:29 2026]
rule prepare_project:
    input: resources/tyndp/NT/cba/networks/rl_2030.nc, resources/tyndp/NT/cba/networks/msv_2030.nc, resources/tyndp/NT/cba/transmission_projects.csv, resources/tyndp/NT/cba/storage_projects.csv, resources/tyndp/NT/cba/cba_project_methods.csv, resources/tyndp/NT/costs_2030_processed.csv
    output: resources/tyndp/NT/cba/networks/project_t16_2030.nc
    jobid: 131
    reason: Missing output files: resources/tyndp/NT/cba/networks/project_t16_2030.nc
    wildcards: run=NT, cba_project=t16, planning_horizons=2030
    resources: mem_mb=40000, mem_mib=38147, disk_mb=8000, disk_mib=7630, tmpdir=<TBD>, runtime=60, partition=big
Submitted job 131 with external jobid 'Submitted batch job 1256808'.
Select jobs to execute...
Execute 1 jobs...

[Fri Jun 19 19:50:39 2026]
rule solve_cba_reference_network:
    input: resources/tyndp/NT/cba/networks/rl_2030.nc
    output: results/tyndp/NT/cba/networks/reference_2030.nc
    log: results/tyndp/NT/logs/cba/reference/reference_2030_solver.log, results/tyndp/NT/logs/cba/reference/reference_2030_memory.log, results/tyndp/NT/logs/cba/reference/reference_2030_python.log
    jobid: 10
    reason: Code has changed since last execution
    wildcards: run=NT, planning_horizons=2030
    resources: mem_mb=40000, mem_mib=38147, disk_mb=8000, disk_mib=7630, tmpdir=<TBD>, runtime=60, partition=big
Submitted job 10 with external jobid 'Submitted batch job 1256809'.
[Fri Jun 19 19:51:29 2026]
Finished jobid: 126 (Rule: prepare_project)
1 of 13 steps (8%) done
Select jobs to execute...
Execute 1 jobs...

[Fri Jun 19 19:51:29 2026]
rule solve_cba_network:
    input: resources/tyndp/NT/cba/networks/project_t4_2030.nc
    output: results/tyndp/NT/cba/networks/project_t4_2030.nc
    log: results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log, results/tyndp/NT/logs/cba/projects/project_t4_2030_memory.log, results/tyndp/NT/logs/cba/projects/project_t4_2030_python.log
    jobid: 125
    reason: Input files updated by another job: resources/tyndp/NT/cba/networks/project_t4_2030.nc; Code has changed since last execution
    wildcards: run=NT, cba_project=t4, planning_horizons=2030
    resources: mem_mb=40000, mem_mib=38147, disk_mb=8000, disk_mib=7630, tmpdir=<TBD>, runtime=60, partition=big
Submitted job 125 with external jobid 'Submitted batch job 1256810'.
[Fri Jun 19 19:51:29 2026]
Finished jobid: 131 (Rule: prepare_project)
2 of 13 steps (15%) done
Select jobs to execute...
Job rate limit reached, waiting for free slots.
Execute 1 jobs...

[Fri Jun 19 19:51:39 2026]
rule solve_cba_network:
    input: resources/tyndp/NT/cba/networks/project_t16_2030.nc
    output: results/tyndp/NT/cba/networks/project_t16_2030.nc
    log: results/tyndp/NT/logs/cba/projects/project_t16_2030_solver.log, results/tyndp/NT/logs/cba/projects/project_t16_2030_memory.log, results/tyndp/NT/logs/cba/projects/project_t16_2030_python.log
    jobid: 130
    reason: Input files updated by another job: resources/tyndp/NT/cba/networks/project_t16_2030.nc; Code has changed since last execution
    wildcards: run=NT, cba_project=t16, planning_horizons=2030
    resources: mem_mb=40000, mem_mib=38147, disk_mb=8000, disk_mib=7630, tmpdir=<TBD>, runtime=60, partition=big
Submitted job 130 with external jobid 'Submitted batch job 1256811'.
[Fri Jun 19 20:23:50 2026]
Error in rule solve_cba_network:
    message: For further error details see the cluster/cloud log and the log files of the involved rule(s).
    jobid: 125
    input: resources/tyndp/NT/cba/networks/project_t4_2030.nc
    output: results/tyndp/NT/cba/networks/project_t4_2030.nc
    log: results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log, results/tyndp/NT/logs/cba/projects/project_t4_2030_memory.log, results/tyndp/NT/logs/cba/projects/project_t4_2030_python.log (check log file(s) for error details)
    external_jobid: Submitted batch job 1256810
[Fri Jun 19 20:24:30 2026]
Error in rule solve_cba_reference_network:
    message: For further error details see the cluster/cloud log and the log files of the involved rule(s).
    jobid: 10
    input: resources/tyndp/NT/cba/networks/rl_2030.nc
    output: results/tyndp/NT/cba/networks/reference_2030.nc
Error in rule solve_cba_network:
    message: For further error details see the cluster/cloud log and the log files of the involved rule(s).
    jobid: 130
    input: resources/tyndp/NT/cba/networks/project_t16_2030.nc
    output: results/tyndp/NT/cba/networks/project_t16_2030.nc
    log: results/tyndp/NT/logs/cba/projects/project_t16_2030_solver.log, results/tyndp/NT/logs/cba/projects/project_t16_2030_memory.log, results/tyndp/NT/logs/cba/projects/project_t16_2030_python.log (check log file(s) for error details)
    external_jobid: Submitted batch job 1256811
Exiting because a job execution failed. Look below for error messages
[Fri Jun 19 20:26:11 2026]
Error in rule solve_cba_network:
    message: None
    jobid: 125
    input: resources/tyndp/NT/cba/networks/project_t4_2030.nc
    output: results/tyndp/NT/cba/networks/project_t4_2030.nc
    log: results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log, results/tyndp/NT/logs/cba/projects/project_t4_2030_memory.log, results/tyndp/NT/logs/cba/projects/project_t4_2030_python.log (check log file(s) for error details)
[Fri Jun 19 20:26:11 2026]
Error in rule solve_cba_reference_network:
    message: None
    jobid: 10
    input: resources/tyndp/NT/cba/networks/rl_2030.nc
    output: results/tyndp/NT/cba/networks/reference_2030.nc
    log: results/tyndp/NT/logs/cba/reference/reference_2030_solver.log, results/tyndp/NT/logs/cba/reference/reference_2030_memory.log, results/tyndp/NT/logs/cba/reference/reference_2030_python.log (check log file(s) for error details)
[Fri Jun 19 20:26:11 2026]
Error in rule solve_cba_network:
    message: None
    jobid: 130
    input: resources/tyndp/NT/cba/networks/project_t16_2030.nc
    output: results/tyndp/NT/cba/networks/project_t16_2030.nc
    log: results/tyndp/NT/logs/cba/projects/project_t16_2030_solver.log, results/tyndp/NT/logs/cba/projects/project_t16_2030_memory.log, results/tyndp/NT/logs/cba/projects/project_t16_2030_python.log (check log file(s) for error details)
Complete log(s): /scratch/htc-panfs/mmeng/open-tyndp/.snakemake/log/2026-06-19T195006.130808.snakemake.log
WorkflowError:
At least one job did not complete successfully.

Checklist

  • Security scan(s) show no high-severity bugs, critical vulnerabilities, or exposed secrets.
  • I tested my contribution locally and it works as intended.
  • Code and workflow changes are sufficiently documented.
  • [ ] Changed dependencies are added to pixi.toml (using pixi add <dependency-name>).
  • [ ] Changes in configuration options are added in config/config.default.yaml.
  • [ ] Changes in configuration options are documented in doc/configtables/*.csv.
  • [ ] Changes in configuration options are added in config/test/*.yaml.
  • The multiple weather/climate years test is passing locally (using pixi run -e open-tyndp tyndp-cyears-test).
  • [ ] Open-TYNDP SPDX license header added to all touched files.
  • [ ] For new data sources or versions, these instructions have been followed.
  • [ ] New rules are documented in the appropriate doc/*.rst files.
  • A release note doc/release_notes.rst is added.
  • [ ] Major features are documented with up-to-date information in doc/index.rst.
  • [ ] Module docstrings added to new Python scripts.

@measrainsey measrainsey self-assigned this Jun 19, 2026
@measrainsey measrainsey added the CBA Cost Benefit Analysis label Jun 19, 2026
@measrainsey measrainsey changed the title fix: dispose of Gurobi environment after a rolling horizon finishes fix: release Gurobi license after a rolling horizon solve finishes Jun 19, 2026
@measrainsey measrainsey added the bug Something isn't working label Jun 19, 2026
@measrainsey measrainsey changed the title fix: release Gurobi license after a rolling horizon solve finishes fix: release Gurobi license after a rolling horizon solve completes; make workflow fail if rolling horizon optimization fails when using HiGHS Jun 21, 2026
@measrainsey measrainsey changed the title fix: release Gurobi license after a rolling horizon solve completes; make workflow fail if rolling horizon optimization fails when using HiGHS fix: make CBA workflow release Gurobi license after each rolling horizon optimization and fail if optimization is infeasible when using HiGHS Jun 21, 2026
@measrainsey
measrainsey marked this pull request as ready for review June 21, 2026 15:10
@tgilon
tgilon self-requested a review July 1, 2026 12:40

@tgilon tgilon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @measrainsey for this additional feature! It will help us to track failing workflows more accurately. I have suggested some changes to dispose_gurobi_model. Let me know what you think of them!

Comment thread scripts/cba/solve_cba_network.py Outdated
Comment thread scripts/cba/solve_cba_network.py
Comment thread scripts/cba/solve_cba_network.py Outdated
Comment thread scripts/cba/solve_cba_network.py Outdated
Comment thread scripts/cba/solve_cba_network.py Outdated
Comment thread doc/release_notes.rst Outdated
Comment thread scripts/cba/solve_cba_network.py Outdated
Comment thread scripts/cba/solve_cba_network.py Outdated
measrainsey and others added 9 commits July 6, 2026 17:20
…del()`

Co-authored-by: Thomas Gilon <thomas.gilon@openenergytransition.org>
Co-authored-by: Thomas Gilon <thomas.gilon@openenergytransition.org>
Co-authored-by: Thomas Gilon <thomas.gilon@openenergytransition.org>
Co-authored-by: Thomas Gilon <thomas.gilon@openenergytransition.org>
Co-authored-by: Thomas Gilon <thomas.gilon@openenergytransition.org>
Co-authored-by: Thomas Gilon <thomas.gilon@openenergytransition.org>
 Conflicts:
	doc/release_notes.rst
@measrainsey

Copy link
Copy Markdown
Member Author

Thank you @tgilon for your review and refactoring! It looks much cleaner now and nice that it's solver-agnostic :)

I tested the updated code and confirms it works as intended: if Gurobi is used, the model license is released between rolling horizons so there's no clash in license usage. And if HiGHS is used and the optimization is infeasible, the workflow raises an error instead of silently continuing on.

This PR is then ready for another round of review!

Testing that Gurobi license is released between rolling horizon windows

I used the following config:

Details
run:
  name: "NT"

scenario:
  planning_horizons:
  - 2030

clustering:
  temporal:
    resolution_sector: 1H

solving:
  options:
    assign_all_duals: true
    include_objective_constant: false
  solver:
    name: gurobi
    options: gurobi-default
  partition: big
  mem_mb: 40000
  runtime: 1h

cba:
  planning_horizons:
  - 2030

  projects: [t4, t16]

  msv_extraction:
    solving:
      options:
        include_objective_constant: false
      solver:
        name: gurobi
        options: gurobi-default
      solver_options:
        gurobi-default:
          BarConvTol: 1.0e-08
      partition: big
      mem_mb: 40000
      runtime: 1h

  # Rolling horizon solving settings
  solving:
    options:
      include_objective_constant: false
    partition: big
    mem_mb: 40000
    runtime: 1h

    solver:
      name: gurobi
      options: gurobi-simplex

    solver_options:
      gurobi-simplex:
        FeasibilityTol: 1.0e-08
        OptimalityTol: 1.0e-08

And ran the command snakemake --profile profiles/slurm -call cba --configfile config/config.tyndp.yaml config/config.zib.yaml.

The various projects' and reference networks can solve multiple horizons without running into licensing issues:

Details
[Wed Jul  8 00:18:35 2026]
localrule solve_cba_network:
    input: resources/tyndp/NT/cba/networks/project_t4_2030.nc
    output: results/tyndp/NT/cba/networks/project_t4_2030.nc
    log: results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log, results/tyndp/NT/logs/cba/projects/project_t4_2030_memory.log, results/tyndp/NT/logs/cba/projects/project_t4_2030_python.log
    jobid: 0
    reason: Forced execution
    wildcards: run=NT, cba_project=t4, planning_horizons=2030
    resources: mem_mb=40000, mem_mib=38147, disk_mb=8000, disk_mib=7630, tmpdir=scratch/htc/mmeng, runtime=60, partition=big
INFO:pypsa.network.io:New version 1.2.4 available! (Current: 1.1.2)
INFO:pypsa.network.io:Imported network 'PyPSA-Eur (tyndp)' has buses, carriers, generators, global_constraints, links, loads, shapes, storage_units, stores, sub_networks
INFO:scripts.solve_network:Add load shedding for all carriers.
WARNING:pypsa.network.io:The following generators are already defined and will be skipped (use overwrite=True to overwrite): AL H2 load shedding, AT H2 load shedding, BA H2 load shedding, BE H2 load shedding, BG H2 load shedding, CH H2 load shedding, CY H2 load shedding, CZ H2 load shedding, DE H2 load shedding, DK H2 load shedding, EE H2 load shedding, ES H2 load shedding, FI H2 load shedding, FR H2 load shedding, GB H2 load shedding, GR H2 load shedding, HR H2 load shedding, HU H2 load shedding, IE H2 load shedding, IT H2 load shedding, LT H2 load shedding, LU H2 load shedding, LV H2 load shedding, ME H2 load shedding, MK H2 load shedding, MT H2 load shedding, NL H2 load shedding, NO H2 load shedding, PL H2 load shedding, PT H2 load shedding, RO H2 load shedding, RS H2 load shedding, SE H2 load shedding, SI H2 load shedding, SK H2 load shedding, IBIT H2 load shedding, IBFI H2 load shedding
WARNING:pypsa.network.io:The following generators are already defined and will be skipped (use overwrite=True to overwrite): AL00 load shedding, AT00 load shedding, BA00 load shedding, BE00 load shedding, BG00 load shedding, CH00 load shedding, CY00 load shedding, CZ00 load shedding, DE00 load shedding, DKE1 load shedding, DKW1 load shedding, EE00 load shedding, ES00 load shedding, FI00 load shedding, FR00 load shedding, FR15 load shedding, GB00 load shedding, GBNI load shedding, GR00 load shedding, GR03 load shedding, HR00 load shedding, HU00 load shedding, IE00 load shedding, ITCA load shedding, ITCN load shedding, ITCS load shedding, ITN1 load shedding, ITS1 load shedding, ITSA load shedding, ITSI load shedding, LT00 load shedding, LUB1 load shedding, LUF1 load shedding, LUG1 load shedding, LUV1 load shedding, LV00 load shedding, ME00 load shedding, MK00 load shedding, MT00 load shedding, NL00 load shedding, NOM1 load shedding, NON1 load shedding, NOS0 load shedding, PL00 load shedding, PT00 load shedding, RO00 load shedding, RS00 load shedding, SE01 load shedding, SE02 load shedding, SE03 load shedding, SE04 load shedding, SI00 load shedding, SK00 load shedding, ITCO load shedding, ITVI load shedding
WARNING:scripts.add_electricity:tech_colors for carriers ['none'] not defined in config.

  0%|          | 0/53 [00:00<?, ?it/s]INFO:__main__:Optimizing network for snapshot horizon [2009-01-01 00:00:00:2009-01-07 23:00:00] (1/53).
/scratch/htc/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/pypsa/optimization/optimize.py:527: FutureWarning: Passing an int for `transmission_losses` is deprecated and will be removed in PyPSA 2.0. Explicitly pass {'mode': 'tangents', 'segments': 2} (current behavior) or use the new secant-based losses via `transmission_losses=True`.
  m = n.optimize.create_model(
INFO:linopy.model: Solve problem using Gurobi solver
INFO:linopy.model:Solver logs written to `results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log`.
INFO:linopy.model:Solver options:
 - threads: 32
 - method: 1
 - NodeMethod: 1
 - Seed: 123
 - AggFill: 0
 - PreDual: 0
 - FeasibilityTol: 1e-08
 - OptimalityTol: 1e-08
 - ScaleFlag: -1
Set parameter WLSAccessID
Set parameter WLSSecret
Set parameter LicenseID to value 2464355
WLS license 2464355 - registered to Open Energy Transition GmbH
Warning for adding constraints: zero or small (< 1e-13) coefficients, ignored
Set parameter Threads to value 32
Set parameter Method to value 1
Set parameter NodeMethod to value 1
Set parameter Seed to value 123
Set parameter AggFill to value 0
Set parameter PreDual to value 0
Set parameter FeasibilityTol to value 1e-08
Set parameter OptimalityTol to value 1e-08
Set parameter ScaleFlag to value -1
Set parameter LogFile to value "/scratch/htc/mmeng/open-tyndp/results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log"
Gurobi Optimizer version 13.0.2 build v13.0.2rc1 (linux64 - "Debian GNU/Linux 13 (trixie)")

CPU model: Intel(R) Xeon(R) Gold 6338 CPU @ 2.00GHz, instruction set [SSE2|AVX|AVX2|AVX512]
Thread count: 64 physical cores, 128 logical processors, using up to 8 threads

Non-default parameters:
FeasibilityTol  1e-08
OptimalityTol  1e-08
Method  1
NodeMethod  1
AggFill  0
PreDual  0
Seed  123
Threads  32

WLS license 2464355 - registered to Open Energy Transition GmbH
Optimize a model with 783062 rows, 397320 columns and 1391514 nonzeros (Min)
Model fingerprint: 0x10bca2fb
Model has 360528 linear objective coefficients
Coefficient statistics:
  Matrix range     [1e-02, 1e+00]
  Objective range  [9e-03, 1e+05]
  Bounds range     [3e+00, 2e+03]
  RHS range        [1e-02, 2e+09]
Warning: Model contains large rhs
         Consider reformulating model or setting NumericFocus parameter
         to avoid numerical issues.

Presolve time: 3.49s
Presolved: 30782 rows, 227660 columns, 383099 nonzeros

Iteration    Objective       Primal Inf.    Dual Inf.      Time
       0    6.5488432e+09   6.925716e+07   0.000000e+00      4s
   21915    1.1089058e+10   2.534517e+07   0.000000e+00      5s

Extra simplex iterations after uncrush: 169
   51482    1.2026248e+10   0.000000e+00   0.000000e+00      8s

Solved in 51482 iterations and 8.14 seconds (3.14 work units)
Optimal objective  1.202624832e+10
Warning: environment still referenced so free is deferred (Continue to use WLS)
INFO:linopy.constants: Optimization successful: 
Status: ok
Termination condition: optimal
Solution: 397320 primals, 783062 duals
Objective: 1.20e+10
Solver model: available
Solver message: 2


  2%|| 1/53 [00:38<33:23, 38.53s/it]INFO:__main__:Optimizing network for snapshot horizon [2009-01-07 23:00:00:2009-01-14 22:00:00] (2/53).
WARNING:pypsa.optimization.constraints:Stores ['AT00 battery', 'BE00 battery', 'DE00 battery', 'DKW1 battery', 'ES00 battery', 'GB00 battery', 'GBNI battery', 'HU00 battery', 'ITCA battery', 'ITCS battery', 'ITSA battery', 'ITSI battery', 'LT00 battery', 'LUG1 battery', 'LV00 battery', 'NL00 battery', 'SE01 battery', 'SE03 battery', 'SE04 battery', 'SK00 battery']: Cyclic energy level constraint overrules initial value setting. User-defined e_initial will be ignored.
/scratch/htc/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/pypsa/optimization/optimize.py:527: FutureWarning: Passing an int for `transmission_losses` is deprecated and will be removed in PyPSA 2.0. Explicitly pass {'mode': 'tangents', 'segments': 2} (current behavior) or use the new secant-based losses via `transmission_losses=True`.
  m = n.optimize.create_model(
INFO:linopy.model: Solve problem using Gurobi solver
INFO:linopy.model:Solver logs written to `results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log`.
INFO:linopy.model:Solver options:
 - threads: 32
 - method: 1
 - NodeMethod: 1
 - Seed: 123
 - AggFill: 0
 - PreDual: 0
 - FeasibilityTol: 1e-08
 - OptimalityTol: 1e-08
 - ScaleFlag: -1
Set parameter WLSAccessID
Set parameter WLSSecret
Set parameter LicenseID to value 2464355
WLS license 2464355 - registered to Open Energy Transition GmbH
Warning for adding constraints: zero or small (< 1e-13) coefficients, ignored
Set parameter Threads to value 32
Set parameter Method to value 1
Set parameter NodeMethod to value 1
Set parameter Seed to value 123
Set parameter AggFill to value 0
Set parameter PreDual to value 0
Set parameter FeasibilityTol to value 1e-08
Set parameter OptimalityTol to value 1e-08
Set parameter ScaleFlag to value -1
Set parameter LogFile to value "/scratch/htc/mmeng/open-tyndp/results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log"
Gurobi Optimizer version 13.0.2 build v13.0.2rc1 (linux64 - "Debian GNU/Linux 13 (trixie)")

CPU model: Intel(R) Xeon(R) Gold 6338 CPU @ 2.00GHz, instruction set [SSE2|AVX|AVX2|AVX512]
Thread count: 64 physical cores, 128 logical processors, using up to 8 threads

Non-default parameters:
FeasibilityTol  1e-08
OptimalityTol  1e-08
Method  1
NodeMethod  1
AggFill  0
PreDual  0
Seed  123
Threads  32

WLS license 2464355 - registered to Open Energy Transition GmbH
Optimize a model with 783098 rows, 397320 columns and 1391514 nonzeros (Min)
Model fingerprint: 0x21e49750
Model has 360528 linear objective coefficients
Coefficient statistics:
  Matrix range     [1e-02, 1e+00]
  Objective range  [9e-03, 1e+05]
  Bounds range     [2e+00, 7e+03]
  RHS range        [6e-03, 2e+09]
Warning: Model contains large rhs
         Consider reformulating model or setting NumericFocus parameter
         to avoid numerical issues.

Presolve time: 1.54s
Presolved: 31123 rows, 228380 columns, 384094 nonzeros

Iteration    Objective       Primal Inf.    Dual Inf.      Time
       0    6.3417729e+09   3.827817e+07   0.000000e+00      2s
   51161    1.1775350e+10   0.000000e+00   1.188588e+04      5s

Extra simplex iterations after uncrush: 206
   51367    1.1775350e+10   0.000000e+00   0.000000e+00      6s

Solved in 51367 iterations and 5.61 seconds (2.80 work units)
Optimal objective  1.177535032e+10
Warning: environment still referenced so free is deferred (Continue to use WLS)
INFO:linopy.constants: Optimization successful: 
Status: ok
Termination condition: optimal
Solution: 397320 primals, 783098 duals
Objective: 1.18e+10
Solver model: available
Solver message: 2

Testing that the workflow raises error if HiGHS is used and the RH solve is infeasible

To test this, I used a similar yaml, just with HiGHS instead (and ran the same command as above):

Details
run:
  name: "NT"

scenario:
  planning_horizons:
  - 2030

clustering:
  temporal:
    resolution_sector: 1H

solving:
  options:
    assign_all_duals: true
    include_objective_constant: false
  solver:
    name: gurobi
    options: gurobi-default
  partition: big
  mem_mb: 40000
  runtime: 1h

cba:
  planning_horizons:
  - 2030

  projects: [t4, t16]

  msv_extraction:
    solving:
      options:
        include_objective_constant: false
      solver:
        name: gurobi
        options: gurobi-default
      solver_options:
        gurobi-default:
          BarConvTol: 1.0e-08
      partition: big
      mem_mb: 40000
      runtime: 1h

  # Rolling horizon solving settings
  solving:
    options:
      include_objective_constant: false
    partition: big
    mem_mb: 40000
    runtime: 1h

    solver:
      name: highs
      options: highs-simplex

    solver_options:
      highs-simplex:
        primal_feasibility_tolerance: 1.0e-08
        dual_feasibility_tolerance: 1.0e-08

With this, the solves all failed at a later planning horizon, such as:

Details
 92%|█████████▏| 49/53 [42:45<03:22, 50.62s/it]INFO:__main__:Optimizing network for snapshot horizon [2009-12-07 23:00:00:2009-12-14 22:00:00] (50/53).
WARNING:pypsa.optimization.constraints:Stores ['BE00 battery', 'DKW1 battery', 'FR00 battery', 'GB00 battery', 'GBNI battery', 'IE00 battery', 'LV00 battery', 'NL00 battery']: Cyclic energy level constraint overrules initial value setting. User-defined e_initial will be ignored.
/scratch/htc/mmeng/open-tyndp/.pixi/envs/open-tyndp/lib/python3.12/site-packages/pypsa/optimization/optimize.py:527: FutureWarning: Passing an int for `transmission_losses` is deprecated and will be removed in PyPSA 2.0. Explicitly pass {'mode': 'tangents', 'segments': 2} (current behavior) or use the new secant-based losses via `transmission_losses=True`.
  m = n.optimize.create_model(
INFO:linopy.model: Solve problem using Highs solver
INFO:linopy.model:Solver logs written to `results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log`.
INFO:linopy.model:Solver options:
 - solver: simplex
 - parallel: off
 - primal_feasibility_tolerance: 1e-08
 - dual_feasibility_tolerance: 1e-08
 - random_seed: 123
Running HiGHS 1.14.0 (git hash: n/a): Copyright (c) 2026 under MIT licence terms
INFO:linopy.solvers:Log file at /scratch/htc/mmeng/open-tyndp/results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log
LP has 783098 rows; 397320 cols; 1391514 nonzeros
Coefficient ranges:
  Matrix  [1e-02, 1e+00]
  Cost    [9e-03, 1e+05]
  Bound   [9e-01, 5e+03]
  RHS     [1e-02, 2e+09]
WARNING: Problem has some excessively large row bounds
WARNING:    Consider scaling the    bounds by 1e-4, or setting the user_bound_scale option to -12
Presolving model
60590 rows, 295405 cols, 557748 nonzeros 1s
39690 rows, 245412 cols, 410248 nonzeros 4s
Dependent equations search running on 36778 equations with time limit of 1000.00s
Dependent equations search removed 0 rows and 0 nonzeros in 0.02s (limit = 1000.00s)
37032 rows, 239965 cols, 401809 nonzeros 20s
Presolve reductions: rows 37032(-746066); columns 239965(-157355); nonzeros 401809(-989705) 
Solving the presolved LP
Using dual simplex solver
  Iteration        Objective     Infeasibilities num(sum)
          0     0.0000000000e+00 Ph1: 0(0) 20.5s
      38261     1.1706453561e+10 23.2s
Model status        : Infeasible
Simplex   iterations: 38261
Objective value     :  1.1771057570e+10
HiGHS run time      :         23.23
WARNING:linopy.constants:Optimization potentially failed: 
Status: warning
Termination condition: infeasible
Solution: 0 primals, 0 duals
Objective: nan
Solver model: available
Solver message: Infeasible

WARNING:__main__:Optimization failed with status warning and condition infeasible
WARNING:__main__:Fallback also failed: warning / infeasible

 92%|█████████▏| 49/53 [43:19<03:32, 53.04s/it]
WARNING:__main__:Solving status 'warning' with termination condition 'infeasible'
ERROR:root:Uncaught exception
Traceback (most recent call last):
  File "/scratch/htc/mmeng/open-tyndp/.snakemake/scripts/tmpa6cv3qmb.solve_cba_network.py", line 388, in <module>
    solve_network(
  File "/scratch/htc/mmeng/open-tyndp/.snakemake/scripts/tmpa6cv3qmb.solve_cba_network.py", line 342, in solve_network
    raise RuntimeError(
RuntimeError: Solving status 'warning' with termination condition 'infeasible'.
RuleException:
CalledProcessError in file "/scratch/htc/mmeng/open-tyndp/rules/cba.smk", line 427:
Command 'set -euo pipefail;  /scratch/htc/mmeng/open-tyndp/.pixi/envs/open-tyndp/bin/python3.12 /scratch/htc/mmeng/open-tyndp/.snakemake/scripts/tmpa6cv3qmb.solve_cba_network.py' returned non-zero exit status 1.
[Tue Jul  7 23:53:47 2026]
Error in rule solve_cba_network:
    message: None
    jobid: 0
    input: resources/tyndp/NT/cba/networks/project_t4_2030.nc
    output: results/tyndp/NT/cba/networks/project_t4_2030.nc
    log: results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log, results/tyndp/NT/logs/cba/projects/project_t4_2030_memory.log, results/tyndp/NT/logs/cba/projects/project_t4_2030_python.log (check log file(s) for error details)
Shutting down, this might take some time.
Exiting because a job execution failed. Look below for error messages
[Tue Jul  7 23:53:47 2026]
Error in rule solve_cba_network:
    message: None
    jobid: 0
    input: resources/tyndp/NT/cba/networks/project_t4_2030.nc
    output: results/tyndp/NT/cba/networks/project_t4_2030.nc
    log: results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log, results/tyndp/NT/logs/cba/projects/project_t4_2030_memory.log, results/tyndp/NT/logs/cba/projects/project_t4_2030_python.log (check log file(s) for error details)
Storing output in storage.
WorkflowError:
At least one job did not complete successfully.

And consequently, the workflow also raises an error and fails:

Details
[Tue Jul  7 23:41:53 2026]
Error in rule solve_cba_reference_network:
    message: For further error details see the cluster/cloud log and the log files of the involved rule(s).
    jobid: 10
    input: resources/tyndp/NT/cba/networks/rl_2030.nc
    output: results/tyndp/NT/cba/networks/reference_2030.nc
    log: results/tyndp/NT/logs/cba/reference/reference_2030_solver.log, results/tyndp/NT/logs/cba/reference/reference_2030_memory.log, results/tyndp/NT/logs/cba/reference/reference_2030_python.log (check log file(s) for error details)
    external_jobid: Submitted batch job 1790639
[Tue Jul  7 23:53:54 2026]
Error in rule solve_cba_network:
    message: For further error details see the cluster/cloud log and the log files of the involved rule(s).
    jobid: 116
    input: resources/tyndp/NT/cba/networks/project_t4_2030.nc
    output: results/tyndp/NT/cba/networks/project_t4_2030.nc
    log: results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log, results/tyndp/NT/logs/cba/projects/project_t4_2030_memory.log, results/tyndp/NT/logs/cba/projects/project_t4_2030_python.log (check log file(s) for error details)
    external_jobid: Submitted batch job 1790640
[Tue Jul  7 23:54:24 2026]
Error in rule solve_cba_network:
    message: For further error details see the cluster/cloud log and the log files of the involved rule(s).
    jobid: 121
    input: resources/tyndp/NT/cba/networks/project_t16_2030.nc
    output: results/tyndp/NT/cba/networks/project_t16_2030.nc
    log: results/tyndp/NT/logs/cba/projects/project_t16_2030_solver.log, results/tyndp/NT/logs/cba/projects/project_t16_2030_memory.log, results/tyndp/NT/logs/cba/projects/project_t16_2030_python.log (check log file(s) for error details)
    external_jobid: Submitted batch job 1790641
Exiting because a job execution failed. Look below for error messages
[Tue Jul  7 23:54:34 2026]
Error in rule solve_cba_reference_network:
    message: None
    jobid: 10
    input: resources/tyndp/NT/cba/networks/rl_2030.nc
    output: results/tyndp/NT/cba/networks/reference_2030.nc
    log: results/tyndp/NT/logs/cba/reference/reference_2030_solver.log, results/tyndp/NT/logs/cba/reference/reference_2030_memory.log, results/tyndp/NT/logs/cba/reference/reference_2030_python.log (check log file(s) for error details)
[Tue Jul  7 23:54:34 2026]
Error in rule solve_cba_network:
    message: None
    jobid: 116
    input: resources/tyndp/NT/cba/networks/project_t4_2030.nc
    output: results/tyndp/NT/cba/networks/project_t4_2030.nc
    log: results/tyndp/NT/logs/cba/projects/project_t4_2030_solver.log, results/tyndp/NT/logs/cba/projects/project_t4_2030_memory.log, results/tyndp/NT/logs/cba/projects/project_t4_2030_python.log (check log file(s) for error details)
[Tue Jul  7 23:54:34 2026]
Error in rule solve_cba_network:
    message: None
    jobid: 121
    input: resources/tyndp/NT/cba/networks/project_t16_2030.nc
    output: results/tyndp/NT/cba/networks/project_t16_2030.nc
    log: results/tyndp/NT/logs/cba/projects/project_t16_2030_solver.log, results/tyndp/NT/logs/cba/projects/project_t16_2030_memory.log, results/tyndp/NT/logs/cba/projects/project_t16_2030_python.log (check log file(s) for error details)
Complete log(s): /scratch/htc/mmeng/open-tyndp/.snakemake/log/2026-07-07T230945.976426.snakemake.log
WorkflowError:
At least one job did not complete successfully.

@measrainsey
measrainsey requested a review from tgilon July 8, 2026 08:01

@tgilon tgilon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great and thank you @measrainsey for addressing the refactoring! I don't have anything else to add. RTM

@measrainsey
measrainsey merged commit 10dd2ff into master Jul 9, 2026
7 checks passed
@measrainsey
measrainsey deleted the fix/gurobi-license-env branch July 9, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working CBA Cost Benefit Analysis

Projects

None yet

2 participants